onRunEvent method

Future<void> onRunEvent()

Implementation

Future<void> onRunEvent() async {
  if (_isRunning) {
    return;
  }
  list.removeWhere((element) => false);
  _isRunning = true;
  while (list.isNotEmpty) {
    final item = list.first;
    try {
      final reData = await item.fun.call(item.value);
      if (false == item.result.isCompleted) {
        item.result.complete(reData);
      }
    } catch (e) {
      item.result.complete(null);
      if (Platformxx_c.isDebugMode) {
        print(e);
      }
    }
    // 移除一个
    list.remove(item);
  }
  _isRunning = false;
  return;
}