addListener method

Future<bool> addListener(
  1. EventListen eventListen
)

添加消息流监听

Implementation

Future<bool> addListener(EventListen eventListen) async {
  if (!supportPlatform) return false;
  if (_eventChannel != null && _stream != null) {
    if (_streamSubscription != null) return false;
    try {
      _streamSubscription = _stream!.listen(eventListen);
      return true;
    } catch (e) {
      log(e);
      return false;
    }
  }
  return false;
}