buildView method

  1. @override
Widget buildView(
  1. Map<String, dynamic> creationParams,
  2. Set<Factory<OneSequenceGestureRecognizer>>? gestureRecognizers,
  3. PlatformViewCreatedCallback onPlatformViewCreated
)
override

This method builds the appropriate platform view where the street view can be rendered. The viewId is passed as a parameter from the framework on the onPlatformViewCreated callback.

Implementation

@override
Widget buildView(
    Map<String, dynamic> creationParams,
    Set<Factory<OneSequenceGestureRecognizer>>? gestureRecognizers,
    PlatformViewCreatedCallback onPlatformViewCreated) {
  // This is used in the platform side to register the view.
  final String viewType = 'my_street_view';
  if (defaultTargetPlatform == TargetPlatform.android) {
    return AndroidView(
        viewType: viewType,
        onPlatformViewCreated: onPlatformViewCreated,
        creationParams: creationParams,
        gestureRecognizers: gestureRecognizers,
        creationParamsCodec: const StandardMessageCodec());
  } else if (defaultTargetPlatform == TargetPlatform.iOS) {
    return UiKitView(
        viewType: viewType,
        onPlatformViewCreated: onPlatformViewCreated,
        creationParams: creationParams,
        gestureRecognizers: gestureRecognizers,
        creationParamsCodec: const StandardMessageCodec());
  }
  return Text(
      '$defaultTargetPlatform is not yet supported by the maps plugin');
}