run method

Future run(
  1. List<AVoidRunnable> runnableList
)

Implementation

Future run(List<AVoidRunnable> runnableList) async {
  if (runnableList?.isNotEmpty != true) {
    return;
  }

  _completerList = runnableList.map((e) => Completer()).toList();
  for (int i = 0; i < runnableList.length; ++i) {
    runnableList[i]().then((value) {
      _completeRun(i);
    }).catchError((err) {
      _completeRun(i);
    });
  }

  final completeList = _completerList;
  if (null != completeList) {
    for (int i = 0; i < completeList.length; ++i) {
      await completeList[i].future;
    }
  }
  _completerList = null;
}