waitTasks method
Waits the tasks executions and returns a List of waited tasks.
onlySubmitted
if true will wait only forsubmitted
tasks.
Implementation
Future<List<T>> waitTasks({bool onlySubmitted = false}) async {
var tasks = (onlySubmitted ? where((t) => t.wasSubmitted) : this).toList();
await Future.wait(tasks.map((t) => t.waitResult()));
return tasks;
}