initialize method

Future<bool> initialize()

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

Implementation

Future<bool> initialize() async {
  assert(_channel != null, 'You must call setMethodChannel() first');
  if (!_supportPlatform || _channel == null) return false;
  bool? state = await _channel!.invokeMethod<bool?>('startEvent');
  if (state == true && _eventChannel == null) {
    _eventChannel = const EventChannel('fl.camera.event');
    _stream = _eventChannel!.receiveBroadcastStream();
  }
  return state == true && _eventChannel != null && _stream != null;
}