onViewCreate method

void onViewCreate(
  1. int viewId,
  2. LiveCallback callback
)

Implementation

void onViewCreate(int viewId, LiveCallback callback) {
  _callback = callback;
  _channel = MethodChannel(Constants.METHOD_CHANNEL_NAME + viewId.toString());

  var eventName = Constants.EVENT_CHANNEL_NAME + viewId.toString();
  _event = EventChannel(eventName)
      .receiveBroadcastStream()
      .listen(_eventData, onError: _eventError, onDone: _eventDone);

  startPreview();
}