dart await all functions with one line code


in my code, there are functions which do async operations. so I have marked these called functions as async in the function body, I am using await for all the async operations. Is there any clear way to do that?

For example, I want to wrap all async operations with only one await keyword:

    Future<void> _clearTables()async{


Maybe you should try to use RxDart operators like swicthMap or concatMap? It makes a lot of sense in front end development. You can learn it here or here. Depending of when you want to get value you should use proper operator. You can decide to get value if each of the function have finished or take the result from the fastest only. A lot of options here. My suggestion is to find your question related to JavaScript code and then reuse it in Dart.

Answered By – Ensei Tankado

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published