diff --git a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md index 461c45c05d1..510a041358d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.18.0 + +* Adds support for warming up the Google Maps SDK + via `GoogleMapsFlutterAndroid.warmup()`. + ## 2.17.0 * Updates `com.google.android.gms:play-services-maps` to 19.2.0. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/README.md b/packages/google_maps_flutter/google_maps_flutter_android/README.md index ac2a4c3ceb1..196c4cce393 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/README.md +++ b/packages/google_maps_flutter/google_maps_flutter_android/README.md @@ -61,6 +61,14 @@ the issue in the TLHC mode. | Heatmap.maximumZoomIntensity | x | | HeatmapGradient.colorMapSize | ✓ | +## Warmup + +The first time a map is shown, the Google Maps SDK may briefly block +the main thread, which could cause UI jank. +If you prefer to control when this happens, you can call +`GoogleMapsFlutterAndroid.warmup()` at some point before showing any maps to +pre-warm the SDK. See this plugin's example code for one way of using this API. + [1]: https://pub.dev/packages/google_maps_flutter [2]: https://flutter.dev/to/endorsed-federated-plugin [3]: https://docs.flutter.dev/development/platform-integration/android/platform-views diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java index e4bea6b8ffa..17d80873a0a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java @@ -5,9 +5,11 @@ package io.flutter.plugins.googlemaps; import android.content.Context; +import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; +import com.google.android.gms.maps.MapView; import com.google.android.gms.maps.MapsInitializer; import com.google.android.gms.maps.OnMapsSdkInitializedCallback; import io.flutter.plugin.common.BinaryMessenger; @@ -15,6 +17,7 @@ /** GoogleMaps initializer used to initialize the Google Maps SDK with preferred settings. */ final class GoogleMapInitializer implements OnMapsSdkInitializedCallback, Messages.MapsInitializerApi { + private static final String TAG = "GoogleMapInitializer"; private final Context context; private static Messages.Result initializationResult; private boolean rendererInitialized = false; @@ -41,6 +44,24 @@ public void initializeWithPreferredRenderer( } } + @Override + public void warmup() { + Log.i(TAG, "Google Maps warmup started."); + try { + // This creates a fake map view in order to trigger the SDK's + // initialization. For context, see + // https://github.com/flutter/flutter/issues/28493#issuecomment-2919150669. + MapView mv = new MapView(context); + mv.onCreate(null); + mv.onResume(); + mv.onPause(); + mv.onDestroy(); + Log.i(TAG, "Maps warmup complete."); + } catch (Exception e) { + throw new Messages.FlutterError("Could not warm up", e.toString(), null); + } + } + /** * Initializes map renderer to with preferred renderer type. * diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java index 85e0b7926a5..2b1825db00f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java @@ -7657,6 +7657,11 @@ public interface MapsInitializerApi { */ void initializeWithPreferredRenderer( @Nullable PlatformRendererType type, @NonNull Result result); + /** + * Attempts to trigger any thread-blocking work the Google Maps SDK normally does when a map is + * shown for the first time. + */ + void warmup(); /** The codec used by MapsInitializerApi. */ static @NonNull MessageCodec getCodec() { @@ -7706,6 +7711,29 @@ public void error(Throwable error) { channel.setMessageHandler(null); } } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInitializerApi.warmup" + + messageChannelSuffix, + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList<>(); + try { + api.warmup(); + wrapped.add(0, null); + } catch (Throwable exception) { + wrapped = wrapError(exception); + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } } } /** diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/main.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/main.dart index 5261d84beac..06fb6565a80 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/main.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/main.dart @@ -85,7 +85,8 @@ void main() { Completer? _initializedRendererCompleter; -/// Initializes map renderer to the `latest` renderer type. +/// Initializes map renderer to the `latest` renderer type, and calls +/// [GoogleMapsFlutterAndroid.warmup()]. /// /// The renderer must be requested before creating GoogleMap instances, /// as the renderer can be initialized only once per application context. @@ -100,11 +101,13 @@ Future initializeMapRenderer() async { WidgetsFlutterBinding.ensureInitialized(); - final GoogleMapsFlutterPlatform platform = GoogleMapsFlutterPlatform.instance; - unawaited((platform as GoogleMapsFlutterAndroid) + final GoogleMapsFlutterAndroid platform = + GoogleMapsFlutterPlatform.instance as GoogleMapsFlutterAndroid; + unawaited(platform .initializeWithRenderer(AndroidMapRenderer.latest) .then((AndroidMapRenderer initializedRenderer) => - completer.complete(initializedRenderer))); + completer.complete(initializedRenderer)) + .then((_) => platform.warmup())); return completer.future; } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart index 255bd0b9aa1..e06deb40c93 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart @@ -65,7 +65,9 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { /// Creates a new Android maps implementation instance. GoogleMapsFlutterAndroid({ @visibleForTesting MapsApi Function(int mapId)? apiProvider, - }) : _apiProvider = apiProvider ?? _productionApiProvider; + @visibleForTesting MapsInitializerApi? initializerApi, + }) : _apiProvider = apiProvider ?? _productionApiProvider, + _initializerApi = initializerApi ?? MapsInitializerApi(); /// Registers the Android implementation of GoogleMapsFlutterPlatform. static void registerWith() { @@ -77,6 +79,8 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { // A method to create MapsApi instances, which can be overridden for testing. final MapsApi Function(int mapId) _apiProvider; + final MapsInitializerApi _initializerApi; + /// The per-map handlers for callbacks from the host side. @visibleForTesting final Map hostMapHandlers = @@ -532,9 +536,8 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { preferredRenderer = null; } - final MapsInitializerApi hostApi = MapsInitializerApi(); - final PlatformRendererType initializedRenderer = - await hostApi.initializeWithPreferredRenderer(preferredRenderer); + final PlatformRendererType initializedRenderer = await _initializerApi + .initializeWithPreferredRenderer(preferredRenderer); return switch (initializedRenderer) { PlatformRendererType.latest => AndroidMapRenderer.latest, @@ -542,6 +545,12 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { }; } + /// Attempts to trigger any thread-blocking work + /// the Google Maps SDK normally does when a map is shown for the first time. + Future warmup() async { + await _initializerApi.warmup(); + } + Widget _buildView( int creationId, PlatformViewCreatedCallback onPlatformViewCreated, { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart index d77cb4b83ea..563ffd32d13 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart @@ -3104,6 +3104,32 @@ class MapsInitializerApi { return (pigeonVar_replyList[0] as PlatformRendererType?)!; } } + + /// Attempts to trigger any thread-blocking work + /// the Google Maps SDK normally does when a map is shown for the first time. + Future warmup() async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.google_maps_flutter_android.MapsInitializerApi.warmup$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } } /// Dummy interface to force generation of the platform view creation params, diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart b/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart index 04989b20e00..42b85904d26 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart @@ -786,6 +786,10 @@ abstract class MapsInitializerApi { @async PlatformRendererType initializeWithPreferredRenderer( PlatformRendererType? type); + + /// Attempts to trigger any thread-blocking work + /// the Google Maps SDK normally does when a map is shown for the first time. + void warmup(); } /// Dummy interface to force generation of the platform view creation params, diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml index a01f2c34b88..8dc5362c215 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_android description: Android implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.17.0 +version: 2.18.0 environment: sdk: ^3.6.0 diff --git a/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart b/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart index e5e8047f89c..1f455614726 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart @@ -15,7 +15,8 @@ import 'package:mockito/mockito.dart'; import 'google_maps_flutter_android_test.mocks.dart'; -@GenerateNiceMocks(>[MockSpec()]) +@GenerateNiceMocks( + >[MockSpec(), MockSpec()]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -32,6 +33,40 @@ void main() { expect(GoogleMapsFlutterPlatform.instance, isA()); }); + test('normal usage does not call MapsInitializerApi', () async { + final MockMapsApi api = MockMapsApi(); + final MockMapsInitializerApi initializerApi = MockMapsInitializerApi(); + final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid( + apiProvider: (_) => api, initializerApi: initializerApi); + const int mapId = 1; + maps.ensureApiInitialized(mapId); + await maps.init(1); + + verifyZeroInteractions(initializerApi); + }); + + test('initializeWithPreferredRenderer forwards the initialization call', + () async { + final MockMapsApi api = MockMapsApi(); + final MockMapsInitializerApi initializerApi = MockMapsInitializerApi(); + final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid( + apiProvider: (_) => api, initializerApi: initializerApi); + await maps.initializeWithRenderer(AndroidMapRenderer.latest); + + verify(initializerApi + .initializeWithPreferredRenderer(PlatformRendererType.latest)); + }); + + test('warmup forwards the initialization call', () async { + final MockMapsApi api = MockMapsApi(); + final MockMapsInitializerApi initializerApi = MockMapsInitializerApi(); + final GoogleMapsFlutterAndroid maps = GoogleMapsFlutterAndroid( + apiProvider: (_) => api, initializerApi: initializerApi); + await maps.warmup(); + + verify(initializerApi.warmup()); + }); + test('init calls waitForMap', () async { final MockMapsApi api = MockMapsApi(); final GoogleMapsFlutterAndroid maps = diff --git a/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.mocks.dart b/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.mocks.dart index 463abd22234..544e28588ee 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.mocks.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in google_maps_flutter_android/test/google_maps_flutter_android_test.dart. // Do not manually edit this file. @@ -25,20 +25,35 @@ import 'package:mockito/src/dummies.dart' as _i3; // ignore_for_file: subtype_of_sealed_class class _FakePlatformPoint_0 extends _i1.SmartFake implements _i2.PlatformPoint { - _FakePlatformPoint_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakePlatformPoint_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakePlatformLatLng_1 extends _i1.SmartFake implements _i2.PlatformLatLng { - _FakePlatformLatLng_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakePlatformLatLng_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakePlatformLatLngBounds_2 extends _i1.SmartFake implements _i2.PlatformLatLngBounds { - _FakePlatformLatLngBounds_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakePlatformLatLngBounds_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [MapsApi]. @@ -60,17 +75,22 @@ class MockMapsApi extends _i1.Mock implements _i2.MapsApi { @override _i4.Future waitForMap() => (super.noSuchMethod( - Invocation.method(#waitForMap, []), + Invocation.method( + #waitForMap, + [], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future updateMapConfiguration( - _i2.PlatformMapConfiguration? configuration, - ) => + _i2.PlatformMapConfiguration? configuration) => (super.noSuchMethod( - Invocation.method(#updateMapConfiguration, [configuration]), + Invocation.method( + #updateMapConfiguration, + [configuration], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -82,7 +102,14 @@ class MockMapsApi extends _i1.Mock implements _i2.MapsApi { List? idsToRemove, ) => (super.noSuchMethod( - Invocation.method(#updateCircles, [toAdd, toChange, idsToRemove]), + Invocation.method( + #updateCircles, + [ + toAdd, + toChange, + idsToRemove, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -94,7 +121,14 @@ class MockMapsApi extends _i1.Mock implements _i2.MapsApi { List? idsToRemove, ) => (super.noSuchMethod( - Invocation.method(#updateHeatmaps, [toAdd, toChange, idsToRemove]), + Invocation.method( + #updateHeatmaps, + [ + toAdd, + toChange, + idsToRemove, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -105,7 +139,13 @@ class MockMapsApi extends _i1.Mock implements _i2.MapsApi { List? idsToRemove, ) => (super.noSuchMethod( - Invocation.method(#updateClusterManagers, [toAdd, idsToRemove]), + Invocation.method( + #updateClusterManagers, + [ + toAdd, + idsToRemove, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -117,7 +157,14 @@ class MockMapsApi extends _i1.Mock implements _i2.MapsApi { List? idsToRemove, ) => (super.noSuchMethod( - Invocation.method(#updateMarkers, [toAdd, toChange, idsToRemove]), + Invocation.method( + #updateMarkers, + [ + toAdd, + toChange, + idsToRemove, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -129,7 +176,14 @@ class MockMapsApi extends _i1.Mock implements _i2.MapsApi { List? idsToRemove, ) => (super.noSuchMethod( - Invocation.method(#updatePolygons, [toAdd, toChange, idsToRemove]), + Invocation.method( + #updatePolygons, + [ + toAdd, + toChange, + idsToRemove, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -141,7 +195,14 @@ class MockMapsApi extends _i1.Mock implements _i2.MapsApi { List? idsToRemove, ) => (super.noSuchMethod( - Invocation.method(#updatePolylines, [toAdd, toChange, idsToRemove]), + Invocation.method( + #updatePolylines, + [ + toAdd, + toChange, + idsToRemove, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -153,11 +214,14 @@ class MockMapsApi extends _i1.Mock implements _i2.MapsApi { List? idsToRemove, ) => (super.noSuchMethod( - Invocation.method(#updateTileOverlays, [ - toAdd, - toChange, - idsToRemove, - ]), + Invocation.method( + #updateTileOverlays, + [ + toAdd, + toChange, + idsToRemove, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -169,77 +233,100 @@ class MockMapsApi extends _i1.Mock implements _i2.MapsApi { List? idsToRemove, ) => (super.noSuchMethod( - Invocation.method(#updateGroundOverlays, [ - toAdd, - toChange, - idsToRemove, - ]), + Invocation.method( + #updateGroundOverlays, + [ + toAdd, + toChange, + idsToRemove, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future<_i2.PlatformPoint> getScreenCoordinate( - _i2.PlatformLatLng? latLng, - ) => + _i2.PlatformLatLng? latLng) => (super.noSuchMethod( - Invocation.method(#getScreenCoordinate, [latLng]), - returnValue: _i4.Future<_i2.PlatformPoint>.value( - _FakePlatformPoint_0( - this, - Invocation.method(#getScreenCoordinate, [latLng]), - ), + Invocation.method( + #getScreenCoordinate, + [latLng], ), - returnValueForMissingStub: _i4.Future<_i2.PlatformPoint>.value( - _FakePlatformPoint_0( - this, - Invocation.method(#getScreenCoordinate, [latLng]), + returnValue: _i4.Future<_i2.PlatformPoint>.value(_FakePlatformPoint_0( + this, + Invocation.method( + #getScreenCoordinate, + [latLng], ), - ), + )), + returnValueForMissingStub: + _i4.Future<_i2.PlatformPoint>.value(_FakePlatformPoint_0( + this, + Invocation.method( + #getScreenCoordinate, + [latLng], + ), + )), ) as _i4.Future<_i2.PlatformPoint>); @override _i4.Future<_i2.PlatformLatLng> getLatLng( - _i2.PlatformPoint? screenCoordinate, - ) => + _i2.PlatformPoint? screenCoordinate) => (super.noSuchMethod( - Invocation.method(#getLatLng, [screenCoordinate]), - returnValue: _i4.Future<_i2.PlatformLatLng>.value( - _FakePlatformLatLng_1( - this, - Invocation.method(#getLatLng, [screenCoordinate]), - ), + Invocation.method( + #getLatLng, + [screenCoordinate], ), - returnValueForMissingStub: _i4.Future<_i2.PlatformLatLng>.value( - _FakePlatformLatLng_1( - this, - Invocation.method(#getLatLng, [screenCoordinate]), + returnValue: _i4.Future<_i2.PlatformLatLng>.value(_FakePlatformLatLng_1( + this, + Invocation.method( + #getLatLng, + [screenCoordinate], ), - ), + )), + returnValueForMissingStub: + _i4.Future<_i2.PlatformLatLng>.value(_FakePlatformLatLng_1( + this, + Invocation.method( + #getLatLng, + [screenCoordinate], + ), + )), ) as _i4.Future<_i2.PlatformLatLng>); @override _i4.Future<_i2.PlatformLatLngBounds> getVisibleRegion() => (super.noSuchMethod( - Invocation.method(#getVisibleRegion, []), + Invocation.method( + #getVisibleRegion, + [], + ), returnValue: _i4.Future<_i2.PlatformLatLngBounds>.value( - _FakePlatformLatLngBounds_2( - this, - Invocation.method(#getVisibleRegion, []), + _FakePlatformLatLngBounds_2( + this, + Invocation.method( + #getVisibleRegion, + [], ), - ), + )), returnValueForMissingStub: _i4.Future<_i2.PlatformLatLngBounds>.value( - _FakePlatformLatLngBounds_2( - this, - Invocation.method(#getVisibleRegion, []), + _FakePlatformLatLngBounds_2( + this, + Invocation.method( + #getVisibleRegion, + [], ), - ), + )), ) as _i4.Future<_i2.PlatformLatLngBounds>); @override _i4.Future moveCamera(_i2.PlatformCameraUpdate? cameraUpdate) => (super.noSuchMethod( - Invocation.method(#moveCamera, [cameraUpdate]), + Invocation.method( + #moveCamera, + [cameraUpdate], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -250,69 +337,138 @@ class MockMapsApi extends _i1.Mock implements _i2.MapsApi { int? durationMilliseconds, ) => (super.noSuchMethod( - Invocation.method(#animateCamera, [ - cameraUpdate, - durationMilliseconds, - ]), + Invocation.method( + #animateCamera, + [ + cameraUpdate, + durationMilliseconds, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future getZoomLevel() => (super.noSuchMethod( - Invocation.method(#getZoomLevel, []), + Invocation.method( + #getZoomLevel, + [], + ), returnValue: _i4.Future.value(0.0), returnValueForMissingStub: _i4.Future.value(0.0), ) as _i4.Future); @override _i4.Future showInfoWindow(String? markerId) => (super.noSuchMethod( - Invocation.method(#showInfoWindow, [markerId]), + Invocation.method( + #showInfoWindow, + [markerId], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future hideInfoWindow(String? markerId) => (super.noSuchMethod( - Invocation.method(#hideInfoWindow, [markerId]), + Invocation.method( + #hideInfoWindow, + [markerId], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future isInfoWindowShown(String? markerId) => (super.noSuchMethod( - Invocation.method(#isInfoWindowShown, [markerId]), + Invocation.method( + #isInfoWindowShown, + [markerId], + ), returnValue: _i4.Future.value(false), returnValueForMissingStub: _i4.Future.value(false), ) as _i4.Future); @override _i4.Future setStyle(String? style) => (super.noSuchMethod( - Invocation.method(#setStyle, [style]), + Invocation.method( + #setStyle, + [style], + ), returnValue: _i4.Future.value(false), returnValueForMissingStub: _i4.Future.value(false), ) as _i4.Future); @override _i4.Future didLastStyleSucceed() => (super.noSuchMethod( - Invocation.method(#didLastStyleSucceed, []), + Invocation.method( + #didLastStyleSucceed, + [], + ), returnValue: _i4.Future.value(false), returnValueForMissingStub: _i4.Future.value(false), ) as _i4.Future); @override _i4.Future clearTileCache(String? tileOverlayId) => (super.noSuchMethod( - Invocation.method(#clearTileCache, [tileOverlayId]), + Invocation.method( + #clearTileCache, + [tileOverlayId], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future<_i5.Uint8List> takeSnapshot() => (super.noSuchMethod( - Invocation.method(#takeSnapshot, []), - returnValue: _i4.Future<_i5.Uint8List>.value(_i5.Uint8List(0)), - returnValueForMissingStub: _i4.Future<_i5.Uint8List>.value( - _i5.Uint8List(0), + Invocation.method( + #takeSnapshot, + [], ), + returnValue: _i4.Future<_i5.Uint8List>.value(_i5.Uint8List(0)), + returnValueForMissingStub: + _i4.Future<_i5.Uint8List>.value(_i5.Uint8List(0)), ) as _i4.Future<_i5.Uint8List>); } + +/// A class which mocks [MapsInitializerApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockMapsInitializerApi extends _i1.Mock + implements _i2.MapsInitializerApi { + @override + String get pigeonVar_messageChannelSuffix => (super.noSuchMethod( + Invocation.getter(#pigeonVar_messageChannelSuffix), + returnValue: _i3.dummyValue( + this, + Invocation.getter(#pigeonVar_messageChannelSuffix), + ), + returnValueForMissingStub: _i3.dummyValue( + this, + Invocation.getter(#pigeonVar_messageChannelSuffix), + ), + ) as String); + + @override + _i4.Future<_i2.PlatformRendererType> initializeWithPreferredRenderer( + _i2.PlatformRendererType? type) => + (super.noSuchMethod( + Invocation.method( + #initializeWithPreferredRenderer, + [type], + ), + returnValue: _i4.Future<_i2.PlatformRendererType>.value( + _i2.PlatformRendererType.legacy), + returnValueForMissingStub: _i4.Future<_i2.PlatformRendererType>.value( + _i2.PlatformRendererType.legacy), + ) as _i4.Future<_i2.PlatformRendererType>); + + @override + _i4.Future warmup() => (super.noSuchMethod( + Invocation.method( + #warmup, + [], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); +}