buildView method
Widget
buildView(
- int viewId,
- void onPlatformViewCreated(
- int
)
)
override
Implementation
@override
Widget buildView(int viewId, void Function(int) onPlatformViewCreated) {
const String viewType = '<platform-view-type>';
final platform = defaultTargetPlatform;
switch (platform) {
case TargetPlatform.android:
return AndroidView(
viewType: viewType,
onPlatformViewCreated: onPlatformViewCreated,
creationParams: <String, dynamic>{
'id': viewId,
},
creationParamsCodec: const StandardMessageCodec(),
);
case TargetPlatform.iOS:
return UiKitView(
viewType: viewType,
onPlatformViewCreated: onPlatformViewCreated,
creationParams: <String, dynamic>{
'id': viewId,
},
creationParamsCodec: const StandardMessageCodec(),
);
default:
throw UnsupportedError(
'Platform $platform is not supported by this plugin');
}
}