buildView method

  1. @override
Widget buildView(
  1. Map<String, dynamic> arguments,
  2. PlatformViewCreatedCallback onPlatformViewCreated
)
override

Returns a widget displaying the button.

Implementation

@override
Widget buildView(
  Map<String, dynamic> arguments,
  PlatformViewCreatedCallback onPlatformViewCreated,
) {
  if (defaultTargetPlatform == TargetPlatform.android) {
    return AndroidView(
      viewType: 'ChromeCastButton',
      onPlatformViewCreated: onPlatformViewCreated,
      creationParams: arguments,
      creationParamsCodec: const StandardMessageCodec(),
    );
  }
  if (defaultTargetPlatform == TargetPlatform.iOS) {
    return UiKitView(
      viewType: 'ChromeCastButton',
      onPlatformViewCreated: onPlatformViewCreated,
      creationParams: arguments,
      creationParamsCodec: const StandardMessageCodec(),
    );
  }
  return Text('$defaultTargetPlatform is not supported by ChromeCast plugin');
}