You can use Future.wait
to wait for a list of futures:
import 'dart:async';
Future main() async {
var data = [];
var futures = <Future>[];
for (var d in data) {
futures.add(d.loadData());
}
await Future.wait(futures);
}
More Related Contents:
- What is the true meaning of pass-by-reference in modern languages like Dart?
- When should I use a FutureBuilder?
- Future.wait() for multiple futures
- how to implement a main function in polymer apps
- How do I format a date with Dart?
- Passing data between screens in Flutter
- What is the difference between the “const” and “final” keywords in Dart?
- Converting timestamp
- How to preserve widget states in flutter, when navigating using BottomNavigationBar?
- What are the ?? double question marks in Dart?
- Flutter setState to another class?
- Flutter get context in initState method
- How does the const constructor actually work?
- Flutter – Read text file from assets
- dart advantage of a factory constructor identifier
- Flutter Error: MediaQuery.of() called with a context that does not contain a MediaQuery
- What is the difference between “show” and “as” in an import statement?
- How do I build different versions of my Flutter app for qa/dev/prod?
- How to Pick files and Images for upload with flutter web
- Creating function with variable number of arguments or parameters in Dart
- Flutter: Retrieving top-level state from child returns null
- How do I run a reoccurring function, in Dart?
- Instantiate a class from a string
- Implement an Observer pattern in Dart
- Flutter: Is it somehow possible to create App Widgets (Android) and Today Extensions (iOS)? [duplicate]
- convert a String of “uint8list” to a Unit8List
- How can I simulate a tap event on a Flutter widget?
- How do you get the document id after adding document in Cloud Firestore in Dart
- Why only static fields can be declared as ‘const’?
- how to add or remove item to the the existing array in firestore ?