Home > Back-end >  See the whole length of a printed into console list
See the whole length of a printed into console list

Time:03-16

I've printed a very long array (about 2k lenght) into console. Unfortunately console cut it and I can't see the whole content, how can I see the entire list? My purpose is to use the content into another file in the project.

Thanks all

CodePudding user response:

You may take the array.toString() in a string variable and can check the length of the string. Now you can according to the length being printed on the console, print the subString(s) of that string using for loop. This might be one way.

CodePudding user response:

Use

https://stackoverflow.com/a/54122851/12103616 or

main() async {
  List letters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"];
  File file = new File("Letters.txt");
  for (int i = 0; i < 10; i  ) {
    await file.writeAsString("${letters[i]}", mode: FileMode.append);
  }
}
  • Related