The question says itself, here I have a list which calling write method a couple of times but it's not providing output sequentially.
void main() {
List<int> list = [1, 2, 3, 4];
write(list);
write(list);
}
write functions takes the List and print the values in the delay of 1 millisecond
write(List<int> values) async {
for (int value in values) {
await Future.delayed(new Duration(microseconds: 1));
print(value);
}
}
Output:
I/flutter (21092): 1
I/flutter (21092): 1
I/flutter (21092): 2
I/flutter (21092): 2
I/flutter (21092): 3
I/flutter (21092): 3
I/flutter (21092): 4
I/flutter (21092): 4
Expected Output:
I/flutter (21092): 1
I/flutter (21092): 2
I/flutter (21092): 3
I/flutter (21092): 4
I/flutter (21092): 1
I/flutter (21092): 2
I/flutter (21092): 3
I/flutter (21092): 4