initAndroidView method

AndroidViewController initAndroidView ({@required int id, @required String viewType, @required TextDirection layoutDirection, dynamic creationParams, MessageCodec creationParamsCodec, PlatformViewCreatedCallback onPlatformViewCreated })

Creates a controller for a new Android view.

id is an unused unique identifier generated with platformViewsRegistry.

viewType is the identifier of the Android view type to be created, a factory for this view type must have been registered on the platform side. Platform view factories are typically registered by plugin code. Plugins can register a platform view factory with PlatformViewRegistry#registerViewFactory.

creationParams will be passed as the args argument of PlatformViewFactory#create

creationParamsCodec is the codec used to encode creationParams before sending it to the platform side. It should match the codec passed to the constructor of PlatformViewFactory. This is typically one of: StandardMessageCodec, JSONMessageCodec, StringCodec, or BinaryCodec.

The Android view will only be created after AndroidViewController.setSize is called for the first time.

The id,viewType, and layoutDirection parameters must not be null. If creationParams is non null then cretaionParamsCodec must not be null.

Implementation

static AndroidViewController initAndroidView({
  @required int id,
  @required String viewType,
  @required TextDirection layoutDirection,
  dynamic creationParams,
  MessageCodec<dynamic> creationParamsCodec,
  PlatformViewCreatedCallback onPlatformViewCreated,
}) {
  assert(id != null);
  assert(viewType != null);
  assert(layoutDirection != null);
  assert(creationParams == null || creationParamsCodec != null);
  return AndroidViewController._(
    id,
    viewType,
    creationParams,
    creationParamsCodec,
    layoutDirection,
    onPlatformViewCreated,
  );
}