onRunEvent method

Future<bool> onRunEvent()

Implementation

Future<bool> onRunEvent() async {
  if (_isRunning) {
    return false;
  }
  _isRunning = true;
  try {
    while (list.isNotEmpty) {
      final rebool = await onListen.call(list.first);
      if (rebool) {
        // 清空
        list.clear();
      } else {
        // 移除一个
        list.removeFirst();
      }
    }
  } catch (e) {
    if (kDebugMode) {
      print(e);
    }
  }
  _isRunning = false;
  return true;
}