init method

  1. @override
Future init(
  1. int viewId
)
override

Initializes the platform interface with id.

This method is called when the plugin is first initialized.

Implementation

@override
Future<dynamic> init(int viewId) async {
  MethodChannel? channel;
  if (!_channels.containsKey(viewId)) {
    channel = MethodChannel('flutter_google_street_view_$viewId');
    channel.setMethodCallHandler(
        (MethodCall call) => _handleMethodCall(call, viewId));
    _channels[viewId] = channel;
  } else
    channel = _channels[viewId];
  final data = await channel!.invokeMethod('streetView#waitForStreetView');
  if (data.containsKey('streetViewCount')) {
    _nativeStreetViewCreatedCount = data['streetViewCount'];
  }
  return data;
}