Sometimes you don’t want to turn the function into a Future or mark it async, so the other way to handle a Future is by using the . then function . It takes in a function that will be called with the value type of your Future. It’s similar to a Promise in JavaScript without the resolve, reject explicitness.
Read moreHow do you wait in Flutter?
seconds; timer. start(); // do something to wait for 2 seconds await Future. delayed(const Duration(seconds: 2), (){}); expect(timer. seconds, startTime – 2); });
Read moreWhat is Future wait Flutter?
According to the flutter docs, Future. wait() : Returns a future which will complete once all the provided futures have completed, either with their results , or with an error if any of the provided futures fail.28 Eki 2020
Read more