Sometimes you need to have results of multiple async functions before starting to work on something else. To prevent multiple awaits, chaining futures in . then(), you can simply use Future. wait([]) that returns an array of results you were waiting for.
Read moreHow do you handle Future error in Flutter?
For more granular error handling, you can register a second ( onError ) callback within then() to handle Futures completed with errors . Here is then() ‘s signature: Future<R> then<R>(FutureOr<R> Function(T value) onValue, {Function? onError});
Read more