initialize method

Future<bool> initialize()

初始化消息通道

Implementation

Future<bool> initialize() async {
  if (!supportPlatform) return false;
  bool? state = await channel.invokeMethod<bool?>('startCuriosityEvent');
  state ??= false;
  if (state && _eventChannel == null) {
    _eventChannel = const EventChannel(curiosityEvent);
    _stream = _eventChannel?.receiveBroadcastStream(<dynamic, dynamic>{});
  }
  return state && _eventChannel != null && _stream != null;
}