Slow down the loop for some seconds
For-loop is a function that runs a process again and again. For - loop is used in most of the languages
but we talk about only flutter.
Let's get start
To slow down the for-loop for some seconds, you need make a asynchronous function
like this
void function()async{
for (int i = 0; i < 10; i++) {
print("myValue $i");
}
}
And use the future.delayed to delay the process to some seconds inside the for loop shown below code.
void function()async{
for (int i = 0; i < 10; i++) {
await Future.delayed(Duration(seconds: 1),(){
print("myValue $i");
});
}
Note: don't forget to add await before the future.delayed.
After doing the full process myValue prints after 1 second in the loop and the value of I changes according to the loop after 1 second.