OctMon

flutter中使用 Future.wait 一次执行多个异步操作

字数统计: 35阅读时长: 1 min
2020/06/09
loading

用法:

1
2
3
4
5
6
7
Future.wait([
PackageInfoUtil.init(),
SharedPreferencesUtil.init(),
]).then((e) {
log("init:", e);
callback();
});

执行结果:

1
flutter: init: => [Instance of 'PackageInfo', Instance of 'SharedPreferences']
CATALOG