initialize method

Future<bool> initialize()

第二步 初始化消息通道 Step 2: initialize the message channel

Implementation

Future<bool> initialize() async {
  if (!_supportPlatform) return false;
  bool? state = await _channel.invokeMethod<bool?>('startEvent');
  state ??= false;
  if (state && _eventChannel == null) {
    _eventChannel = const EventChannel(_flCameraEvent);
    _stream = _eventChannel?.receiveBroadcastStream(<dynamic, dynamic>{});
  }
  return state && _eventChannel != null && _stream != null;
}