[dart]flutter how to wait map.forEach to complete in Future<void> function?
问题 sample code Map<String,String> gg={'gg':'abc','kk':'kojk'}; Future<void> secondAsync() async { await Future.delayed(const Duration(seconds: 2)); print("Second!"); gg.forEach((key,value) async{await Future.delayed(const Duration(seconds: 5)); print("Third!"); }); } Future<void> thirdAsync() async { await Future<String>.delayed(const Duration(seconds: 2)); print('third'); } void main() async { secondAsync().then((_){thirdAsync();}); } output Second! third Third! Third! as you can see i want to