onViewCreate method

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

Implementation

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

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