From e85f59070639a9ad97e970b8e9df25d54b938293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20V=C3=A4limaa?= Date: Tue, 29 Oct 2024 19:42:58 +0800 Subject: [PATCH] feat: standalone classic mapview (#181) * feat: implementing separate google map view on flutter side wip * feat: map view ios separation and example app page wip * feat: map view android separation wip * fix: fix tests and format * fix: flutter analyze fix * feature: example app multiple map page supports now non-navigation map * docs: update readme for non-navigation map view * fix: remove navigation variables and references from map view files * docs: update dart doc * refactor: listener and map view refactoring * refactor: navigation viewcontroller now extends map viewcontroller in flutter * refactor: android redundant function removal * fix: general fixes and refactoring * refactor: android base map view refactoring * test: update integration tests for regular google map view * refactor: refactor tests and view handling * refactor: refactoring and minor fixes * test: refactor integration tests --- README.md | 25 + .../maps/flutter/navigation/GoogleMapView.kt | 83 + .../navigation/GoogleMapsBaseMapView.kt | 932 ++++++++ .../GoogleMapsNavigationInspectorHandler.kt | 7 +- .../navigation/GoogleMapsNavigationPlugin.kt | 19 +- .../navigation/GoogleMapsNavigationView.kt | 930 +------- .../GoogleMapsNavigationViewRegistry.kt | 71 - ...iewFactory.kt => GoogleMapsViewFactory.kt} | 34 +- ...ler.kt => GoogleMapsViewMessageHandler.kt} | 56 +- .../navigation/GoogleMapsViewRegistry.kt | 91 + .../maps/flutter/navigation/messages.g.kt | 282 +-- dartdoc_options.yaml | 5 +- doc/map-view.md | 0 example/integration_test/shared.dart | 171 +- .../t01_initialization_test.dart | 77 + .../integration_test/t02_session_test.dart | 16 +- example/integration_test/t06_map_test.dart | 584 +++--- ...8_marker_polygon_polyline_circle_test.dart | 1865 +++++++++-------- example/lib/main.dart | 2 +- example/lib/pages/map.dart | 93 +- example/lib/pages/multiple_views.dart | 205 +- ios/Classes/Convert+MapConfiguration.swift | 4 +- ios/Classes/GoogleMapsNavigationPlugin.swift | 10 +- .../GoogleMapsNavigationSessionManager.swift | 2 +- ios/Classes/GoogleMapsNavigationView.swift | 251 +-- .../GoogleMapsNavigationViewFactory.swift | 17 +- ...ogleMapsNavigationViewMessageHandler.swift | 2 +- .../GoogleMapsNavigationViewRegistry.swift | 5 + ios/Classes/messages.g.swift | 300 +-- lib/google_navigation_flutter.dart | 4 + lib/src/google_maps_map_view.dart | 393 ++++ lib/src/google_maps_map_view_controller.dart | 366 ++++ lib/src/google_maps_navigation_view.dart | 208 ++ ...oogle_maps_navigation_view_controller.dart | 159 ++ lib/src/google_navigation_flutter.dart | 975 +-------- .../google_navigation_flutter_android.dart | 33 +- lib/src/google_navigation_flutter_ios.dart | 33 +- ...navigation_flutter_platform_interface.dart | 28 +- lib/src/method_channel/common_view_api.dart | 51 +- lib/src/method_channel/messages.g.dart | 348 +-- lib/src/types/circles.dart | 3 + lib/src/types/lat_lng.dart | 1 + lib/src/types/lat_lng_bounds.dart | 1 + lib/src/types/markers.dart | 8 + lib/src/types/navigation_view_types.dart | 11 + lib/src/types/polygons.dart | 3 + lib/src/types/polylines.dart | 6 + lib/src/types/stroke_patterns.dart | 5 + .../types/view_initialization_options.dart | 74 +- pigeons/messages.dart | 25 +- test/google_navigation_flutter_test.dart | 31 +- .../google_navigation_flutter_test.mocks.dart | 7 +- test/messages_test.g.dart | 673 +++--- 53 files changed, 5338 insertions(+), 4247 deletions(-) create mode 100644 android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapView.kt create mode 100644 android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsBaseMapView.kt delete mode 100644 android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationViewRegistry.kt rename android/src/main/kotlin/com/google/maps/flutter/navigation/{GoogleMapsNavigationViewFactory.kt => GoogleMapsViewFactory.kt} (60%) rename android/src/main/kotlin/com/google/maps/flutter/navigation/{GoogleMapsNavigationViewMessageHandler.kt => GoogleMapsViewMessageHandler.kt} (88%) create mode 100644 android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsViewRegistry.kt create mode 100644 doc/map-view.md create mode 100644 lib/src/google_maps_map_view.dart create mode 100644 lib/src/google_maps_map_view_controller.dart create mode 100644 lib/src/google_maps_navigation_view.dart create mode 100644 lib/src/google_maps_navigation_view_controller.dart diff --git a/README.md b/README.md index e73bb11..c6705fe 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,8 @@ The view can be controlled with the `GoogleNavigationViewController` that is pas The `GoogleMapsNavigationView` widget should be used within a widget with a bounded size. Using it in an unbounded widget will cause the application to throw a Flutter exception. +You can also add a bare GoogleMapsMapView that works as a normal map view without navigation functionality. + ### Add a navigation view ```dart @@ -139,6 +141,29 @@ class _NavigationSampleState extends State { } ``` +### Add a map view + +```dart +@override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Google Maps Navigation Sample')), + body: _navigationSessionInitialized + ? GoogleMapsMapView( + onViewCreated: _onViewCreated, + initialCameraPosition: CameraPosition( + // Initialize map to user location. + target: _userLocation!, + zoom: 15, + ), + // Other view initialization settings + ) + : const Center(child: CircularProgressIndicator()), + ); + } + +``` + See the [example](./example) directory for a complete navigation sample app. ### Requesting and handling permissions diff --git a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapView.kt b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapView.kt new file mode 100644 index 0000000..95ec8d5 --- /dev/null +++ b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapView.kt @@ -0,0 +1,83 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.maps.flutter.navigation + +import android.content.Context +import android.view.View +import com.google.android.gms.maps.GoogleMapOptions +import com.google.android.gms.maps.MapView +import io.flutter.plugin.platform.PlatformView + +class GoogleMapView +internal constructor( + context: Context, + mapOptions: GoogleMapOptions, + viewId: Int, + viewEventApi: ViewEventApi, + private val viewRegistry: GoogleMapsViewRegistry, + imageRegistry: ImageRegistry +) : PlatformView, GoogleMapsBaseMapView(viewId, mapOptions, viewEventApi, imageRegistry) { + private val _mapView: MapView = MapView(context, mapOptions) + + override fun getView(): View { + return _mapView + } + + init { + // Call all of these three lifecycle functions in sequence to fully + // initialize the map view. + _mapView.onCreate(context.applicationInfo.metaData) + _mapView.onStart() + _mapView.onResume() + + _mapView.getMapAsync { map -> + setMap(map) + initListeners() + imageRegistry.mapViewInitializationComplete() + mapReady() + invalidateViewAfterMapLoad() + } + + viewRegistry.registerMapView(viewId, this) + } + + override fun dispose() { + // When view is disposed, all of these lifecycle functions must be + // called to properly dispose navigation view and prevent leaks. + _mapView.onPause() + _mapView.onStop() + _mapView.onDestroy() + + viewRegistry.unregisterMapView(viewId) + } + + override fun onStart() { + _mapView.onStart() + } + + override fun onResume() { + _mapView.onResume() + } + + override fun onStop() { + _mapView.onStop() + } + + override fun onPause() { + _mapView.onPause() + } +} diff --git a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsBaseMapView.kt b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsBaseMapView.kt new file mode 100644 index 0000000..686a971 --- /dev/null +++ b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsBaseMapView.kt @@ -0,0 +1,932 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.maps.flutter.navigation + +import android.annotation.SuppressLint +import android.content.res.Resources +import android.graphics.Point +import android.location.Location +import android.view.View +import com.google.android.gms.maps.CameraUpdate +import com.google.android.gms.maps.CameraUpdateFactory +import com.google.android.gms.maps.GoogleMap +import com.google.android.gms.maps.GoogleMap.OnMarkerDragListener +import com.google.android.gms.maps.GoogleMapOptions +import com.google.android.gms.maps.model.CameraPosition +import com.google.android.gms.maps.model.Circle +import com.google.android.gms.maps.model.FollowMyLocationOptions +import com.google.android.gms.maps.model.LatLng +import com.google.android.gms.maps.model.LatLngBounds +import com.google.android.gms.maps.model.MapStyleOptions +import com.google.android.gms.maps.model.Marker +import com.google.android.gms.maps.model.Polygon +import com.google.android.gms.maps.model.Polyline +import com.google.android.libraries.navigation.NavigationView + +abstract class GoogleMapsBaseMapView( + protected val viewId: Int, + mapOptions: GoogleMapOptions, + protected val viewEventApi: ViewEventApi, + private val imageRegistry: ImageRegistry +) { + companion object { + const val INVALIDATION_FRAME_SKIP_AMOUNT = 4 // Amount of skip frames before invalidation + } + + private val _frameDelayHandler = FrameDelayHandler(INVALIDATION_FRAME_SKIP_AMOUNT) + private var _map: GoogleMap? = null + private val _markers = mutableListOf() + private val _polygons = mutableListOf() + private val _polylines = mutableListOf() + private val _circles = mutableListOf() + + // Store preferred zoom values here because MapView getMinZoom and + // getMaxZoom always return min/max possible values and not the preferred ones. + private var _minZoomLevelPreference: Float? = null + private var _maxZoomLevelPreference: Float? = null + + // Nullable variable to hold the callback function + private var _mapReadyCallback: ((Result) -> Unit)? = null + private var _loadedCallbackPending = false + + /// Default values for UI features. + private var _consumeMyLocationButtonClickEventsEnabled: Boolean = false + + abstract fun getView(): View + + abstract fun onStart() + + abstract fun onResume() + + abstract fun onStop() + + abstract fun onPause() + + // Method to set the _map object + protected fun setMap(map: GoogleMap) { + _map = map + } + + @Throws(FlutterError::class) + protected fun getMap(): GoogleMap { + if (_map != null) { + return _map!! + } else { + throw FlutterError("mapNotFound", "GoogleMap not initialized yet") + } + } + + init { + _minZoomLevelPreference = mapOptions.minZoomPreference + _maxZoomLevelPreference = mapOptions.maxZoomPreference + } + + protected fun mapReady() { + // Call and clear view ready callback if available. + _mapReadyCallback?.let { callback -> + callback(Result.success(Unit)) + _mapReadyCallback = null + } + } + + protected open fun initListeners() { + getMap().setOnMapClickListener { + viewEventApi.onMapClickEvent( + viewId.toLong(), + LatLngDto(it.latitude, it.longitude), + ) {} + } + getMap().setOnMapLongClickListener { + viewEventApi.onMapLongClickEvent( + viewId.toLong(), + LatLngDto(it.latitude, it.longitude), + ) {} + } + getMap().setOnMarkerClickListener { marker -> + val markerId = findMarkerId(marker) + val controller = findMarkerController(markerId) + + sendMarkerEvent(marker, MarkerEventTypeDto.CLICKED) + + // This return value controls the default onClick behaviour, + // return true for default behaviour to occur and false to not. + // Default behavior is for the camera to move to the marker and an info window to + // appear. + controller?.consumeTapEvents ?: false + } + getMap() + .setOnMarkerDragListener( + object : OnMarkerDragListener { + override fun onMarkerDrag(marker: Marker) { + sendMarkerDragEvent(marker, MarkerDragEventTypeDto.DRAG) + } + + override fun onMarkerDragEnd(marker: Marker) { + sendMarkerDragEvent(marker, MarkerDragEventTypeDto.DRAGEND) + } + + override fun onMarkerDragStart(marker: Marker) { + sendMarkerDragEvent(marker, MarkerDragEventTypeDto.DRAGSTART) + } + } + ) + getMap().setOnInfoWindowClickListener { marker -> + sendMarkerEvent(marker, MarkerEventTypeDto.INFOWINDOWCLICKED) + } + getMap().setOnInfoWindowCloseListener { marker -> + try { + sendMarkerEvent(marker, MarkerEventTypeDto.INFOWINDOWCLOSED) + } catch (exception: FlutterError) { + // Google maps trigger this callback if info window is open for marker that is removed. + // As marker and it's information that maps the marker to the markerId is removed, + // [FlutterError] is thrown. In this case info window close event is not sent. + } + } + getMap().setOnInfoWindowLongClickListener { marker -> + sendMarkerEvent(marker, MarkerEventTypeDto.INFOWINDOWLONGCLICKED) + } + + getMap().setOnPolygonClickListener { polygon -> + val polygonId = findPolygonId(polygon) + viewEventApi.onPolygonClicked(viewId.toLong(), polygonId) {} + } + + getMap().setOnPolylineClickListener { polyline -> + val polylineId = findPolylineId(polyline) + viewEventApi.onPolylineClicked(viewId.toLong(), polylineId) {} + } + + getMap().setOnCircleClickListener { circle -> + val circleId = findCircleId(circle) + viewEventApi.onCircleClicked(viewId.toLong(), circleId) {} + } + + getMap().setOnMyLocationClickListener { viewEventApi.onMyLocationClicked(viewId.toLong()) {} } + + getMap().setOnMyLocationButtonClickListener { + viewEventApi.onMyLocationButtonClicked(viewId.toLong()) {} + _consumeMyLocationButtonClickEventsEnabled + } + + getMap() + .setOnFollowMyLocationCallback( + object : GoogleMap.OnCameraFollowLocationCallback { + override fun onCameraStartedFollowingLocation() { + viewEventApi.onCameraChanged( + viewId.toLong(), + CameraEventTypeDto.ONCAMERASTARTEDFOLLOWINGLOCATION, + Convert.convertCameraPositionToDto(getMap().cameraPosition) + ) {} + } + + override fun onCameraStoppedFollowingLocation() { + viewEventApi.onCameraChanged( + viewId.toLong(), + CameraEventTypeDto.ONCAMERASTOPPEDFOLLOWINGLOCATION, + Convert.convertCameraPositionToDto(getMap().cameraPosition) + ) {} + } + } + ) + } + + /** + * Workaround for map view not showing added or edited map objects immediately after add/edit. + * Schedules [NavigationView.invalidate] call after a certain amount of frames are drawn. In + * marker updates short delay is not enough, [doubleInvalidate] is set to true. + * + * @param doubleInvalidate if true, schedules another invalidate event after the first one. + */ + protected fun invalidateViewAfterMapLoad(doubleInvalidate: Boolean = false) { + if (_loadedCallbackPending) { + return + } + _loadedCallbackPending = true + getMap().setOnMapLoadedCallback { + _loadedCallbackPending = false + _frameDelayHandler.scheduleActionWithFrameDelay { + getView().invalidate() + if (doubleInvalidate) { + _frameDelayHandler.scheduleActionWithFrameDelay { getView().invalidate() } + } + } + } + } + + @Throws(FlutterError::class) + private fun findMarkerId(marker: Marker): String { + return _markers.find { it.marker == marker }?.markerId + ?: throw FlutterError("markerNotFound", "Could not find the marker.") + } + + @Throws(FlutterError::class) + private fun findMarkerController(markerId: String): MarkerController? { + return _markers.find { it.markerId == markerId } + } + + @Throws(FlutterError::class) + private fun findPolygonId(polygon: Polygon): String { + return _polygons.find { it.polygon == polygon }?.polygonId + ?: throw FlutterError("polygonNotFound", "Could not find the polygon.") + } + + @Throws(FlutterError::class) + private fun findPolylineId(polyline: Polyline): String { + return _polylines.find { it.polyline == polyline }?.polylineId + ?: throw FlutterError("polylineNotFound", "Could not find the polyline.") + } + + @Throws(FlutterError::class) + private fun findCircleId(circle: Circle): String { + return _circles.find { it.circle == circle }?.circleId + ?: throw FlutterError("circleNotFound", "Could not find the circle") + } + + @Throws(FlutterError::class) + private fun findPolygonController(polygonId: String): PolygonController? { + return _polygons.find { it.polygonId == polygonId } + } + + @Throws(FlutterError::class) + private fun findPolylineController(polylineId: String): PolylineController? { + return _polylines.find { it.polylineId == polylineId } + } + + @Throws(FlutterError::class) + private fun findCircleController(circleId: String): CircleController? { + return _circles.find { it.circleId == circleId } + } + + @Throws(FlutterError::class) + private fun sendMarkerEvent(marker: Marker, eventType: MarkerEventTypeDto) { + val markerId = findMarkerId(marker) + viewEventApi.onMarkerEvent(viewId.toLong(), markerId, eventType) {} + } + + @Throws(FlutterError::class) + private fun sendMarkerDragEvent(marker: Marker, eventType: MarkerDragEventTypeDto) { + val markerId = findMarkerId(marker) + viewEventApi.onMarkerDragEvent( + viewId.toLong(), + markerId, + eventType, + LatLngDto(marker.position.latitude, marker.position.longitude) + ) {} + } + + fun isMyLocationEnabled(): Boolean { + return getMap().isMyLocationEnabled + } + + @SuppressLint("MissingPermission") + fun setMyLocationEnabled(enabled: Boolean) { + invalidateViewAfterMapLoad() + getMap().isMyLocationEnabled = enabled + } + + fun setMyLocationButtonEnabled(enabled: Boolean) { + invalidateViewAfterMapLoad() + getMap().uiSettings.isMyLocationButtonEnabled = enabled + } + + fun setZoomGesturesEnabled(enabled: Boolean) { + invalidateViewAfterMapLoad() + getMap().uiSettings.isZoomGesturesEnabled = enabled + } + + fun setZoomControlsEnabled(enabled: Boolean) { + invalidateViewAfterMapLoad() + getMap().uiSettings.isZoomControlsEnabled = enabled + } + + fun getMinZoomPreference(): Float { + return _minZoomLevelPreference ?: getMap().minZoomLevel + } + + fun getMaxZoomPreference(): Float { + return _maxZoomLevelPreference ?: getMap().maxZoomLevel + } + + fun resetMinMaxZoomPreference() { + _minZoomLevelPreference = null + _maxZoomLevelPreference = null + getMap().resetMinMaxZoomPreference() + } + + @Throws(FlutterError::class) + fun setMinZoomPreference(minZoomPreference: Float) { + if (minZoomPreference > (_maxZoomLevelPreference ?: getMap().maxZoomLevel)) { + throw FlutterError( + "minZoomGreaterThanMaxZoom", + "Minimum zoom level cannot be greater than maximum zoom level" + ) + } + + _minZoomLevelPreference = minZoomPreference + getMap().setMinZoomPreference(minZoomPreference) + } + + @Throws(FlutterError::class) + fun setMaxZoomPreference(maxZoomPreference: Float) { + if (maxZoomPreference < (_minZoomLevelPreference ?: getMap().minZoomLevel)) { + throw FlutterError( + "maxZoomLessThanMinZoom", + "Maximum zoom level cannot be less than minimum zoom level" + ) + } + + _maxZoomLevelPreference = maxZoomPreference + getMap().setMaxZoomPreference(maxZoomPreference) + } + + fun setCompassEnabled(enabled: Boolean) { + invalidateViewAfterMapLoad() + getMap().uiSettings.isCompassEnabled = enabled + } + + fun setRotateGesturesEnabled(enabled: Boolean) { + getMap().uiSettings.isRotateGesturesEnabled = enabled + } + + fun setScrollGesturesEnabled(enabled: Boolean) { + getMap().uiSettings.isScrollGesturesEnabled = enabled + } + + fun setScrollGesturesDuringRotateOrZoomEnabled(enabled: Boolean) { + getMap().uiSettings.isScrollGesturesEnabledDuringRotateOrZoom = enabled + } + + fun setTiltGesturesEnabled(enabled: Boolean) { + getMap().uiSettings.isTiltGesturesEnabled = enabled + } + + fun setMapToolbarEnabled(enabled: Boolean) { + getMap().uiSettings.isMapToolbarEnabled = enabled + } + + fun setTrafficEnabled(enabled: Boolean) { + getMap().isTrafficEnabled = enabled + } + + fun isMyLocationButtonEnabled(): Boolean { + return getMap().uiSettings.isMyLocationButtonEnabled + } + + fun isZoomGesturesEnabled(): Boolean { + return getMap().uiSettings.isZoomGesturesEnabled + } + + fun isZoomControlsEnabled(): Boolean { + return getMap().uiSettings.isZoomControlsEnabled + } + + fun isCompassEnabled(): Boolean { + return getMap().uiSettings.isCompassEnabled + } + + fun isRotateGesturesEnabled(): Boolean { + return getMap().uiSettings.isRotateGesturesEnabled + } + + fun isScrollGesturesEnabled(): Boolean { + return getMap().uiSettings.isScrollGesturesEnabled + } + + fun isScrollGesturesEnabledDuringRotateOrZoom(): Boolean { + return getMap().uiSettings.isScrollGesturesEnabledDuringRotateOrZoom + } + + fun isTiltGesturesEnabled(): Boolean { + return getMap().uiSettings.isTiltGesturesEnabled + } + + fun isMapToolbarEnabled(): Boolean { + return getMap().uiSettings.isMapToolbarEnabled + } + + fun isTrafficEnabled(): Boolean { + return getMap().isTrafficEnabled + } + + fun getMyLocation(): Location? { + // Remove this functionality and either guide users to use separate flutter + // library for geolocation or implement separate method under + // [GoogleMapsNavigationSessionManager] to fetch the location + // using the [FusedLocationProviderApi]. + @Suppress("DEPRECATION") return getMap().myLocation + } + + fun getCameraPosition(): CameraPosition { + return getMap().cameraPosition ?: CameraPosition(LatLng(0.0, 0.0), 0.0F, 0.0F, 0.0F) + } + + fun getVisibleRegion(): LatLngBounds { + return getMap().projection.visibleRegion.latLngBounds + } + + private fun getMapCallback(callback: (Result) -> Unit): GoogleMap.CancelableCallback { + return object : GoogleMap.CancelableCallback { + override fun onFinish() { + callback(Result.success(true)) + } + + override fun onCancel() { + callback(Result.success(false)) + } + } + } + + private fun animateCamera( + cameraUpdate: CameraUpdate, + duration: Long?, + callback: (Result) -> Unit + ) { + // Native animateCamera() doesn't allow setting null duration so need to do two calls + if (duration == null) { + getMap().animateCamera(cameraUpdate, getMapCallback(callback)) + } else { + getMap().animateCamera(cameraUpdate, duration.toInt(), getMapCallback(callback)) + } + } + + fun animateCameraToCameraPosition( + cameraPosition: CameraPosition, + duration: Long?, + callback: (Result) -> Unit + ) { + animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), duration, callback) + } + + fun animateCameraToLatLng(point: LatLng, duration: Long?, callback: (Result) -> Unit) { + animateCamera(CameraUpdateFactory.newLatLng(point), duration, callback) + } + + fun animateCameraToLatLngBounds( + bounds: LatLngBounds, + padding: Double, + duration: Long?, + callback: (Result) -> Unit + ) { + animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding.toInt()), duration, callback) + } + + fun animateCameraToLatLngZoom( + point: LatLng, + zoom: Double, + duration: Long?, + callback: (Result) -> Unit + ) { + animateCamera(CameraUpdateFactory.newLatLngZoom(point, zoom.toFloat()), duration, callback) + } + + fun animateCameraByScroll( + scrollByDx: Double, + scrollByDy: Double, + duration: Long?, + callback: (Result) -> Unit + ) { + animateCamera( + CameraUpdateFactory.scrollBy(scrollByDx.toFloat(), scrollByDy.toFloat()), + duration, + callback + ) + } + + fun animateCameraByZoom( + zoomBy: Double, + focus: Point?, + duration: Long?, + callback: (Result) -> Unit + ) { + // Native animateCamera() doesn't allow setting null duration or focus so need to split to + // multiple calls + val cameraUpdate = + if (focus != null) { + CameraUpdateFactory.zoomBy(zoomBy.toFloat(), focus) + } else { + CameraUpdateFactory.zoomBy(zoomBy.toFloat()) + } + animateCamera(cameraUpdate, duration, callback) + } + + fun animateCameraToZoom(zoom: Double, duration: Long?, callback: (Result) -> Unit) { + animateCamera(CameraUpdateFactory.zoomTo(zoom.toFloat()), duration, callback) + } + + fun moveCameraToCameraPosition(cameraPosition: CameraPosition) { + return getMap().moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) + } + + fun moveCameraToLatLng(point: LatLng) { + return getMap().moveCamera(CameraUpdateFactory.newLatLng(point)) + } + + fun moveCameraToLatLngBounds(bounds: LatLngBounds, padding: Double) { + return getMap().moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding.toInt())) + } + + fun moveCameraToLatLngZoom(point: LatLng, zoom: Double) { + return getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(point, zoom.toFloat())) + } + + fun moveCameraByScroll(scrollByDx: Double, scrollByDy: Double) { + return getMap() + .moveCamera(CameraUpdateFactory.scrollBy(scrollByDx.toFloat(), scrollByDy.toFloat())) + } + + fun moveCameraByZoom(zoomBy: Double, focus: Point?) { + if (focus != null) { + getMap().moveCamera(CameraUpdateFactory.zoomBy(zoomBy.toFloat(), focus)) + } else { + getMap().moveCamera(CameraUpdateFactory.zoomBy(zoomBy.toFloat())) + } + } + + fun moveCameraToZoom(zoom: Double) { + return getMap().moveCamera(CameraUpdateFactory.zoomTo(zoom.toFloat())) + } + + fun getMapType(): Int { + return getMap().mapType + } + + fun setMapType(mapType: Int) { + invalidateViewAfterMapLoad() + getMap().mapType = mapType + } + + fun setMapStyle(styleJson: String) { + invalidateViewAfterMapLoad() + if (!getMap().setMapStyle(MapStyleOptions(styleJson))) { + throw FlutterError("mapStyleError", "Failed to set map style") + } + } + + @SuppressLint("MissingPermission") + fun followMyLocation(perspective: Int, zoomLevel: Double?) { + invalidateViewAfterMapLoad() + getMap().followMyLocation(perspective) + if (zoomLevel != null) { + val options: FollowMyLocationOptions = + FollowMyLocationOptions.builder().setZoomLevel(zoomLevel.toFloat()).build() + getMap().followMyLocation(perspective, options) + } else { + getMap().followMyLocation(perspective) + } + } + + fun awaitMapReady(callback: (Result) -> Unit) { + if (_map != null) { + // Call the callback immediately as the map is already initialized + callback(Result.success(Unit)) + } else if (_mapReadyCallback != null) { + // If there is already a callback pending, throw an error to avoid overriding it + callback( + Result.failure( + FlutterError( + "mapReadyCallbackAlreadyPending", + "A callback is already pending and cannot be overridden." + ) + ) + ) + } else { + // Save the callback to be called once the map is initialized + _mapReadyCallback = callback + } + } + + fun setConsumeMyLocationButtonClickEventsEnabled(enabled: Boolean) { + _consumeMyLocationButtonClickEventsEnabled = enabled + } + + fun isConsumeMyLocationButtonClickEventsEnabled(): Boolean { + return _consumeMyLocationButtonClickEventsEnabled + } + + fun getMarkers(): List { + return _markers.map { MarkerDto(it.markerId, Convert.markerControllerToMarkerOptions(it)) } + } + + fun addMarkers(markers: List): List { + val result = mutableListOf() + markers.forEach { + val builder = MarkerBuilder() + Convert.sinkMarkerOptions(it.options, builder, imageRegistry) + val options = builder.build() + val marker = getMap().addMarker(options) + if (marker != null) { + val registeredImage = + it.options.icon.registeredImageId?.let { id -> imageRegistry.findRegisteredImage(id) } + val controller = + MarkerController( + marker, + it.markerId, + builder.consumeTapEvents, + it.options.anchor.u.toFloat(), + it.options.anchor.v.toFloat(), + it.options.infoWindow.anchor.u.toFloat(), + it.options.infoWindow.anchor.v.toFloat(), + registeredImage + ) + _markers.add(controller) + result.add(it) + } + } + // Double invalidate map view. Marker icon updates seem to take extra + // time and some times icon did not update properly after single invalidate. + invalidateViewAfterMapLoad(true) + return result + } + + @Throws(FlutterError::class) + fun updateMarkers(markers: List): List { + val result = mutableListOf() + var error: Throwable? = null + markers.forEach { + findMarkerController(it.markerId)?.let { controller -> + Convert.sinkMarkerOptions(it.options, controller, imageRegistry) + result.add(it) + } + ?: run { + error = FlutterError("markerNotFound", "Failed to update marker with id ${it.markerId}") + } + } + error?.let { throw error as Throwable } + // Double invalidate map view. Marker icon updates seem to take extra + // time and some times icon did not update properly after single invalidate. + invalidateViewAfterMapLoad(true) + return result + } + + @Throws(FlutterError::class) + fun removeMarkers(markers: List) { + invalidateViewAfterMapLoad() + var error: Throwable? = null + markers.forEach { + findMarkerController(it.markerId)?.let { controller -> + controller.remove() + _markers.remove(controller) + } + ?: run { + error = FlutterError("markerNotFound", "Failed to remove marker with id ${it.markerId}") + } + } + error?.let { throw error as Throwable } + } + + fun clearMarkers() { + invalidateViewAfterMapLoad() + _markers.forEach { controller -> controller.remove() } + _markers.clear() + } + + fun clear() { + getMap().clear() + _markers.clear() + _polygons.clear() + _polylines.clear() + _circles.clear() + } + + fun getPolygons(): List { + val density = Resources.getSystem().displayMetrics.density + return _polygons.map { + PolygonDto(it.polygonId, Convert.polygonToPolygonOptions(it.polygon, density)) + } + } + + fun addPolygons( + polygons: List, + ): List { + val density = Resources.getSystem().displayMetrics.density + invalidateViewAfterMapLoad() + val result = mutableListOf() + polygons.forEach { + val builder = PolygonBuilder() + Convert.sinkPolygonOptions(it.options, builder, density) + val options = builder.build() + val polygon = getMap().addPolygon(options) + if (polygon != null) { + val controller = PolygonController(polygon, it.polygonId) + _polygons.add(controller) + result.add(it) + } + } + return result + } + + fun updatePolygons(polygons: List): List { + invalidateViewAfterMapLoad() + var error: Throwable? = null + val result = mutableListOf() + val density = Resources.getSystem().displayMetrics.density + polygons.forEach { + findPolygonController(it.polygonId)?.let { controller -> + Convert.sinkPolygonOptions(it.options, controller, density) + result.add(it) + } + ?: run { + error = + FlutterError("polygonNotFound", "Failed to update polygon with id ${it.polygonId}") + } + } + error?.let { throw error as Throwable } + + return result + } + + fun removePolygons(polygons: List) { + invalidateViewAfterMapLoad() + var error: Throwable? = null + polygons.forEach { + findPolygonController(it.polygonId)?.let { controller -> + controller.remove() + _polygons.remove(controller) + } + ?: run { + error = + FlutterError("polygonNotFound", "Failed to remove polygon with id ${it.polygonId}") + } + } + error?.let { throw error as Throwable } + } + + fun clearPolygons() { + invalidateViewAfterMapLoad() + _polygons.forEach { controller -> controller.remove() } + _polygons.clear() + } + + fun getPolylines(): List { + val density = Resources.getSystem().displayMetrics.density + return _polylines.map { + PolylineDto(it.polylineId, Convert.polylineToPolylineOptions(it.polyline, density)) + } + } + + fun addPolylines( + polylines: List, + ): List { + val density = Resources.getSystem().displayMetrics.density + invalidateViewAfterMapLoad() + val result = mutableListOf() + polylines.forEach { + val builder = PolylineBuilder() + Convert.sinkPolylineOptions(it.options, builder, density) + val options = builder.build() + val polyline = getMap().addPolyline(options) + if (polyline != null) { + val controller = PolylineController(polyline, it.polylineId) + _polylines.add(controller) + result.add(it) + } + } + return result + } + + fun updatePolylines(polylines: List): List { + var error: Throwable? = null + val density = Resources.getSystem().displayMetrics.density + invalidateViewAfterMapLoad() + val result = mutableListOf() + polylines.forEach { + findPolylineController(it.polylineId)?.let { controller -> + Convert.sinkPolylineOptions(it.options, controller, density) + result.add(it) + } + ?: run { + error = + FlutterError("polylineNotFound", "Failed to update polyline with id ${it.polylineId}") + } + } + error?.let { throw error as Throwable } + return result + } + + fun removePolylines(polylines: List) { + invalidateViewAfterMapLoad() + var error: Throwable? = null + polylines.forEach { + findPolylineController(it.polylineId)?.let { controller -> + controller.remove() + _polylines.remove(controller) + } + ?: run { + error = + FlutterError("polylineNotFound", "Failed to remove polyline with id ${it.polylineId}") + } + } + error?.let { throw error as Throwable } + } + + fun clearPolylines() { + invalidateViewAfterMapLoad() + _polylines.forEach { controller -> controller.remove() } + _polylines.clear() + } + + fun getCircles(): List { + val density = Resources.getSystem().displayMetrics.density + return _circles.map { + CircleDto(it.circleId, Convert.circleToCircleOptions(it.circle, density)) + } + } + + fun addCircles(circles: List): List { + val density = Resources.getSystem().displayMetrics.density + invalidateViewAfterMapLoad() + val result = mutableListOf() + circles.forEach { + val builder = CircleBuilder() + Convert.sinkCircleOptions(it.options, builder, density) + val options = builder.build() + val circle = getMap().addCircle(options) + if (circle != null) { + val controller = CircleController(circle, it.circleId) + _circles.add(controller) + result.add(it) + } + } + return result + } + + fun updateCircles(circles: List): List { + val density = Resources.getSystem().displayMetrics.density + invalidateViewAfterMapLoad() + val result = mutableListOf() + var error: Throwable? = null + circles.forEach { + findCircleController(it.circleId)?.let { controller -> + Convert.sinkCircleOptions(it.options, controller, density) + result.add(it) + } + ?: run { + error = FlutterError("circleNotFound", "Failed to update circle with id ${it.circleId}") + } + } + error?.let { throw error as Throwable } + return result + } + + fun removeCircles(circles: List) { + invalidateViewAfterMapLoad() + var error: Throwable? = null + circles.forEach { + findCircleController(it.circleId)?.let { controller -> + controller.remove() + _circles.remove(controller) + } + ?: run { + error = FlutterError("circleNotFound", "Failed to remove circle with id ${it.circleId}") + } + } + error?.let { throw error as Throwable } + } + + fun clearCircles() { + invalidateViewAfterMapLoad() + _circles.forEach { controller -> controller.remove() } + _circles.clear() + } + + fun registerOnCameraChangedListener() { + getMap().setOnCameraMoveStartedListener { reason -> + val event = + when (reason) { + GoogleMap.OnCameraMoveStartedListener.REASON_API_ANIMATION, + GoogleMap.OnCameraMoveStartedListener.REASON_DEVELOPER_ANIMATION -> + CameraEventTypeDto.MOVESTARTEDBYAPI + GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE -> + CameraEventTypeDto.MOVESTARTEDBYGESTURE + else -> { + // This should not happen, added that the compiler does not complain. + throw RuntimeException("Unknown camera move started reason: $reason") + } + } + val position = Convert.convertCameraPositionToDto(getMap().cameraPosition) + viewEventApi.onCameraChanged(viewId.toLong(), event, position) {} + } + getMap().setOnCameraMoveListener { + val position = Convert.convertCameraPositionToDto(getMap().cameraPosition) + viewEventApi.onCameraChanged(viewId.toLong(), CameraEventTypeDto.ONCAMERAMOVE, position) {} + } + getMap().setOnCameraIdleListener { + val position = Convert.convertCameraPositionToDto(getMap().cameraPosition) + viewEventApi.onCameraChanged(viewId.toLong(), CameraEventTypeDto.ONCAMERAIDLE, position) {} + } + } +} diff --git a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationInspectorHandler.kt b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationInspectorHandler.kt index 37740cc..6a67bde 100644 --- a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationInspectorHandler.kt +++ b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationInspectorHandler.kt @@ -14,16 +14,15 @@ package com.google.maps.flutter.navigation -class GoogleMapsNavigationInspectorHandler( - private val viewRegistry: GoogleMapsNavigationViewRegistry -) : NavigationInspector { +class GoogleMapsNavigationInspectorHandler(private val viewRegistry: GoogleMapsViewRegistry) : + NavigationInspector { private fun manager(): GoogleMapsNavigationSessionManager { return GoogleMapsNavigationSessionManager.getInstance() } override fun isViewAttachedToSession(viewId: Long): Boolean { /// Is session exists, it's automatically attached to any existing view. - if (viewRegistry.getView(viewId.toInt()) != null) { + if (viewRegistry.getNavigationView(viewId.toInt()) != null) { return manager().isInitialized() } return false diff --git a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationPlugin.kt b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationPlugin.kt index 14ac770..07e8677 100644 --- a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationPlugin.kt +++ b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationPlugin.kt @@ -24,36 +24,35 @@ import io.flutter.embedding.engine.plugins.lifecycle.FlutterLifecycleAdapter /** GoogleMapsNavigationPlugin */ class GoogleMapsNavigationPlugin : FlutterPlugin, ActivityAware { - private lateinit var viewRegistry: GoogleMapsNavigationViewRegistry - private lateinit var viewMessageHandler: GoogleMapsNavigationViewMessageHandler + private lateinit var viewRegistry: GoogleMapsViewRegistry + private lateinit var viewMessageHandler: GoogleMapsViewMessageHandler private lateinit var imageRegistryMessageHandler: GoogleMapsImageRegistryMessageHandler - private lateinit var navigationViewEventApi: NavigationViewEventApi + private lateinit var viewEventApi: ViewEventApi private lateinit var _binding: FlutterPlugin.FlutterPluginBinding private lateinit var lifecycle: Lifecycle private lateinit var imageRegistry: ImageRegistry override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) { - viewRegistry = GoogleMapsNavigationViewRegistry() + viewRegistry = GoogleMapsViewRegistry() imageRegistry = ImageRegistry() - viewMessageHandler = GoogleMapsNavigationViewMessageHandler(viewRegistry) - NavigationViewApi.setUp(binding.binaryMessenger, viewMessageHandler) + viewMessageHandler = GoogleMapsViewMessageHandler(viewRegistry) + MapViewApi.setUp(binding.binaryMessenger, viewMessageHandler) imageRegistryMessageHandler = GoogleMapsImageRegistryMessageHandler(imageRegistry) ImageRegistryApi.setUp(binding.binaryMessenger, imageRegistryMessageHandler) - navigationViewEventApi = NavigationViewEventApi(binding.binaryMessenger) + viewEventApi = ViewEventApi(binding.binaryMessenger) _binding = binding binding.applicationContext.registerComponentCallbacks(viewRegistry) } override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { - NavigationViewApi.setUp(binding.binaryMessenger, null) // Cleanup + MapViewApi.setUp(binding.binaryMessenger, null) // Cleanup ImageRegistryApi.setUp(binding.binaryMessenger, null) GoogleMapsNavigationSessionManager.destroyInstance() binding.applicationContext.unregisterComponentCallbacks(viewRegistry) } override fun onAttachedToActivity(binding: ActivityPluginBinding) { - val factory = - GoogleMapsNavigationViewFactory(viewRegistry, navigationViewEventApi, imageRegistry) + val factory = GoogleMapsViewFactory(viewRegistry, viewEventApi, imageRegistry) _binding.platformViewRegistry.registerViewFactory("google_navigation_flutter", factory) GoogleMapsNavigationSessionManager.createInstance(_binding.binaryMessenger) val inspectorHandler = GoogleMapsNavigationInspectorHandler(viewRegistry) diff --git a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationView.kt b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationView.kt index 1dd9512..baf79f3 100644 --- a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationView.kt +++ b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationView.kt @@ -16,29 +16,11 @@ package com.google.maps.flutter.navigation -import android.annotation.SuppressLint import android.content.Context import android.content.res.Configuration -import android.content.res.Resources -import android.graphics.Point -import android.location.Location import android.view.View -import com.google.android.gms.maps.CameraUpdate import com.google.android.gms.maps.CameraUpdateFactory -import com.google.android.gms.maps.GoogleMap -import com.google.android.gms.maps.GoogleMap.OnCameraFollowLocationCallback -import com.google.android.gms.maps.GoogleMap.OnCameraMoveStartedListener -import com.google.android.gms.maps.GoogleMap.OnMarkerDragListener import com.google.android.gms.maps.GoogleMapOptions -import com.google.android.gms.maps.model.CameraPosition -import com.google.android.gms.maps.model.Circle -import com.google.android.gms.maps.model.FollowMyLocationOptions -import com.google.android.gms.maps.model.LatLng -import com.google.android.gms.maps.model.LatLngBounds -import com.google.android.gms.maps.model.MapStyleOptions -import com.google.android.gms.maps.model.Marker -import com.google.android.gms.maps.model.Polygon -import com.google.android.gms.maps.model.Polyline import com.google.android.libraries.navigation.NavigationView import io.flutter.plugin.platform.PlatformView @@ -46,29 +28,13 @@ class GoogleMapsNavigationView internal constructor( context: Context, mapOptions: GoogleMapOptions, - navigationOptions: NavigationViewOptions, - private val viewId: Int, - private val viewRegistry: GoogleMapsNavigationViewRegistry, - private val navigationViewEventApi: NavigationViewEventApi, + navigationOptions: NavigationViewOptions?, + viewId: Int, + private val viewRegistry: GoogleMapsViewRegistry, + viewEventApi: ViewEventApi, private val imageRegistry: ImageRegistry -) : PlatformView { - companion object { - const val INVALIDATION_FRAME_SKIP_AMOUNT = 4 // Amount of skip frames before invalidation - } - - private val _navigationView: NavigationView - private var _map: GoogleMap? = null - private val _frameDelayHandler = FrameDelayHandler(INVALIDATION_FRAME_SKIP_AMOUNT) - private var _loadedCallbackPending = false - private val _markers = mutableListOf() - private val _polygons = mutableListOf() - private val _polylines = mutableListOf() - private val _circles = mutableListOf() - - // Store preferred zoom values here because MapView getMinZoom and - // getMaxZoom always return min/max possible values and not the preferred ones. - private var _minZoomLevelPreference: Float? = null - private var _maxZoomLevelPreference: Float? = null +) : PlatformView, GoogleMapsBaseMapView(viewId, mapOptions, viewEventApi, imageRegistry) { + private val _navigationView: NavigationView = NavigationView(context, mapOptions) /// Default values for UI features. private var _isNavigationTripProgressBarEnabled: Boolean = false @@ -78,18 +44,12 @@ internal constructor( private var _isSpeedLimitIconEnabled: Boolean = false private var _isSpeedometerEnabled: Boolean = false private var _isTrafficIncidentCardsEnabled: Boolean = true - private var _consumeMyLocationButtonClickEventsEnabled: Boolean = false - - // Nullable variable to hold the callback function - private var _mapReadyCallback: ((Result) -> Unit)? = null override fun getView(): View { return _navigationView } init { - _navigationView = NavigationView(context, mapOptions) - // Call all of these three lifecycle functions in sequence to fully // initialize the navigation view. _navigationView.onCreate(context.applicationInfo.metaData) @@ -99,7 +59,7 @@ internal constructor( // Initialize navigation view with given navigation view options var navigationViewEnabled: Boolean = false if ( - navigationOptions.navigationUiEnabledPreference == NavigationUIEnabledPreference.AUTOMATIC + navigationOptions?.navigationUiEnabledPreference == NavigationUIEnabledPreference.AUTOMATIC ) { val navigatorInitialized = GoogleMapsNavigationSessionManager.getInstance().isInitialized() if (navigatorInitialized) { @@ -108,11 +68,8 @@ internal constructor( } _navigationView.isNavigationUiEnabled = navigationViewEnabled - _minZoomLevelPreference = mapOptions.minZoomPreference - _maxZoomLevelPreference = mapOptions.maxZoomPreference - _navigationView.getMapAsync { map -> - _map = map + setMap(map) initListeners() imageRegistry.mapViewInitializationComplete() @@ -124,15 +81,11 @@ internal constructor( } // Call and clear view ready callback if available. - _mapReadyCallback?.let { callback -> - callback(Result.success(Unit)) - _mapReadyCallback = null - } - + mapReady() invalidateViewAfterMapLoad() } - viewRegistry.registerView(viewId, this) + viewRegistry.registerNavigationView(viewId, this) } override fun dispose() { @@ -155,163 +108,22 @@ internal constructor( _navigationView.removeOnRecenterButtonClickedListener {} - viewRegistry.unregisterView(viewId) - } - - private fun initListeners() { - _navigationView.addOnRecenterButtonClickedListener { - navigationViewEventApi.onRecenterButtonClicked(viewId.toLong()) {} - } - _navigationView.addOnNavigationUiChangedListener { - navigationViewEventApi.onNavigationUIEnabledChanged(viewId.toLong(), it) {} - } - getMap().setOnMapClickListener { - navigationViewEventApi.onMapClickEvent( - viewId.toLong(), - LatLngDto(it.latitude, it.longitude), - ) {} - } - getMap().setOnMapLongClickListener { - navigationViewEventApi.onMapLongClickEvent( - viewId.toLong(), - LatLngDto(it.latitude, it.longitude), - ) {} - } - getMap().setOnMarkerClickListener { marker -> - val markerId = findMarkerId(marker) - val controller = findMarkerController(markerId) - - sendMarkerEvent(marker, MarkerEventTypeDto.CLICKED) - - // This return value controls the default onClick behaviour, - // return true for default behaviour to occur and false to not. - // Default behavior is for the camera to move to the marker and an info window to - // appear. - controller?.consumeTapEvents ?: false - } - getMap() - .setOnMarkerDragListener( - object : OnMarkerDragListener { - override fun onMarkerDrag(marker: Marker) { - sendMarkerDragEvent(marker, MarkerDragEventTypeDto.DRAG) - } - - override fun onMarkerDragEnd(marker: Marker) { - sendMarkerDragEvent(marker, MarkerDragEventTypeDto.DRAGEND) - } - - override fun onMarkerDragStart(marker: Marker) { - sendMarkerDragEvent(marker, MarkerDragEventTypeDto.DRAGSTART) - } - } - ) - getMap().setOnInfoWindowClickListener { marker -> - sendMarkerEvent(marker, MarkerEventTypeDto.INFOWINDOWCLICKED) - } - getMap().setOnInfoWindowCloseListener { marker -> - try { - sendMarkerEvent(marker, MarkerEventTypeDto.INFOWINDOWCLOSED) - } catch (exception: FlutterError) { - // Google maps trigger this callback if info window is open for marker that is removed. - // As marker and it's information that maps the marker to the markerId is removed, - // [FlutterError] is thrown. In this case info window close event is not sent. - } - } - getMap().setOnInfoWindowLongClickListener { marker -> - sendMarkerEvent(marker, MarkerEventTypeDto.INFOWINDOWLONGCLICKED) - } - - getMap().setOnPolygonClickListener { polygon -> - val polygonId = findPolygonId(polygon) - navigationViewEventApi.onPolygonClicked(viewId.toLong(), polygonId) {} - } - - getMap().setOnPolylineClickListener { polyline -> - val polylineId = findPolylineId(polyline) - navigationViewEventApi.onPolylineClicked(viewId.toLong(), polylineId) {} - } - - getMap().setOnCircleClickListener { circle -> - val circleId = findCircleId(circle) - navigationViewEventApi.onCircleClicked(viewId.toLong(), circleId) {} - } - - getMap().setOnMyLocationClickListener { - navigationViewEventApi.onMyLocationClicked(viewId.toLong()) {} - } - - getMap().setOnMyLocationButtonClickListener { - navigationViewEventApi.onMyLocationButtonClicked(viewId.toLong()) {} - _consumeMyLocationButtonClickEventsEnabled - } - - getMap() - .setOnFollowMyLocationCallback( - object : OnCameraFollowLocationCallback { - override fun onCameraStartedFollowingLocation() { - navigationViewEventApi.onCameraChanged( - viewId.toLong(), - CameraEventTypeDto.ONCAMERASTARTEDFOLLOWINGLOCATION, - Convert.convertCameraPositionToDto(getMap().cameraPosition) - ) {} - } - - override fun onCameraStoppedFollowingLocation() { - navigationViewEventApi.onCameraChanged( - viewId.toLong(), - CameraEventTypeDto.ONCAMERASTOPPEDFOLLOWINGLOCATION, - Convert.convertCameraPositionToDto(getMap().cameraPosition) - ) {} - } - } - ) - } - - @Throws(FlutterError::class) - private fun getMap(): GoogleMap { - if (_map != null) { - return _map!! - } else { - throw FlutterError("mapNotFound", "GoogleMap not initialized yet") - } - } - - /** - * Workaround for map view not showing added or edited map objects immediately after add/edit. - * Schedules [NavigationView.invalidate] call after a certain amount of frames are drawn. In - * marker updates short delay is not enough, [doubleInvalidate] is set to true. - * - * @param doubleInvalidate if true, schedules another invalidate event after the first one. - */ - private fun invalidateViewAfterMapLoad(doubleInvalidate: Boolean = false) { - if (_loadedCallbackPending) { - return - } - _loadedCallbackPending = true - getMap().setOnMapLoadedCallback { - _loadedCallbackPending = false - _frameDelayHandler.scheduleActionWithFrameDelay { - _navigationView.invalidate() - if (doubleInvalidate) { - _frameDelayHandler.scheduleActionWithFrameDelay { _navigationView.invalidate() } - } - } - } + viewRegistry.unregisterNavigationView(viewId) } - fun onStart() { + override fun onStart() { _navigationView.onStart() } - fun onResume() { + override fun onResume() { _navigationView.onResume() } - fun onStop() { + override fun onStop() { _navigationView.onStop() } - fun onPause() { + override fun onPause() { _navigationView.onPause() } @@ -323,332 +135,20 @@ internal constructor( _navigationView.onTrimMemory(level) } - @Throws(FlutterError::class) - private fun findMarkerId(marker: Marker): String { - return _markers.find { it.marker == marker }?.markerId - ?: throw FlutterError("markerNotFound", "Could not find the marker.") - } - - @Throws(FlutterError::class) - private fun findMarkerController(markerId: String): MarkerController? { - return _markers.find { it.markerId == markerId } - } - - @Throws(FlutterError::class) - private fun findPolygonId(polygon: Polygon): String { - return _polygons.find { it.polygon == polygon }?.polygonId - ?: throw FlutterError("polygonNotFound", "Could not find the polygon.") - } - - @Throws(FlutterError::class) - private fun findPolylineId(polyline: Polyline): String { - return _polylines.find { it.polyline == polyline }?.polylineId - ?: throw FlutterError("polylineNotFound", "Could not find the polyline.") - } - - @Throws(FlutterError::class) - private fun findCircleId(circle: Circle): String { - return _circles.find { it.circle == circle }?.circleId - ?: throw FlutterError("circleNotFound", "Could not find the circle") - } - - @Throws(FlutterError::class) - private fun findPolygonController(polygonId: String): PolygonController? { - return _polygons.find { it.polygonId == polygonId } - } - - @Throws(FlutterError::class) - private fun findPolylineController(polylineId: String): PolylineController? { - return _polylines.find { it.polylineId == polylineId } - } - - @Throws(FlutterError::class) - private fun findCircleController(circleId: String): CircleController? { - return _circles.find { it.circleId == circleId } - } - - @Throws(FlutterError::class) - private fun sendMarkerEvent(marker: Marker, eventType: MarkerEventTypeDto) { - val markerId = findMarkerId(marker) - navigationViewEventApi.onMarkerEvent(viewId.toLong(), markerId, eventType) {} - } - - @Throws(FlutterError::class) - private fun sendMarkerDragEvent(marker: Marker, eventType: MarkerDragEventTypeDto) { - val markerId = findMarkerId(marker) - navigationViewEventApi.onMarkerDragEvent( - viewId.toLong(), - markerId, - eventType, - LatLngDto(marker.position.latitude, marker.position.longitude) - ) {} - } - - fun isMyLocationEnabled(): Boolean { - return getMap().isMyLocationEnabled - } - - @SuppressLint("MissingPermission") - fun setMyLocationEnabled(enabled: Boolean) { - invalidateViewAfterMapLoad() - getMap().isMyLocationEnabled = enabled - } - - fun setMyLocationButtonEnabled(enabled: Boolean) { - invalidateViewAfterMapLoad() - getMap().uiSettings.isMyLocationButtonEnabled = enabled - } - - fun setZoomGesturesEnabled(enabled: Boolean) { - invalidateViewAfterMapLoad() - getMap().uiSettings.isZoomGesturesEnabled = enabled - } - - fun setZoomControlsEnabled(enabled: Boolean) { - invalidateViewAfterMapLoad() - getMap().uiSettings.isZoomControlsEnabled = enabled - } - - fun setCompassEnabled(enabled: Boolean) { - invalidateViewAfterMapLoad() - getMap().uiSettings.isCompassEnabled = enabled - } - - fun setRotateGesturesEnabled(enabled: Boolean) { - getMap().uiSettings.isRotateGesturesEnabled = enabled - } - - fun setScrollGesturesEnabled(enabled: Boolean) { - getMap().uiSettings.isScrollGesturesEnabled = enabled - } - - fun setScrollGesturesDuringRotateOrZoomEnabled(enabled: Boolean) { - getMap().uiSettings.isScrollGesturesEnabledDuringRotateOrZoom = enabled - } - - fun setTiltGesturesEnabled(enabled: Boolean) { - getMap().uiSettings.isTiltGesturesEnabled = enabled - } - - fun setMapToolbarEnabled(enabled: Boolean) { - getMap().uiSettings.isMapToolbarEnabled = enabled - } - - fun setTrafficEnabled(enabled: Boolean) { - getMap().isTrafficEnabled = enabled - } - - fun isMyLocationButtonEnabled(): Boolean { - return getMap().uiSettings.isMyLocationButtonEnabled - } - - fun isZoomGesturesEnabled(): Boolean { - return getMap().uiSettings.isZoomGesturesEnabled - } - - fun isZoomControlsEnabled(): Boolean { - return getMap().uiSettings.isZoomControlsEnabled - } - - fun isCompassEnabled(): Boolean { - return getMap().uiSettings.isCompassEnabled - } - - fun isRotateGesturesEnabled(): Boolean { - return getMap().uiSettings.isRotateGesturesEnabled - } - - fun isScrollGesturesEnabled(): Boolean { - return getMap().uiSettings.isScrollGesturesEnabled - } - - fun isScrollGesturesEnabledDuringRotateOrZoom(): Boolean { - return getMap().uiSettings.isScrollGesturesEnabledDuringRotateOrZoom - } - - fun isTiltGesturesEnabled(): Boolean { - return getMap().uiSettings.isTiltGesturesEnabled - } - - fun isMapToolbarEnabled(): Boolean { - return getMap().uiSettings.isMapToolbarEnabled - } - - fun isTrafficEnabled(): Boolean { - return getMap().isTrafficEnabled - } - - fun getMyLocation(): Location? { - // Remove this functionality and either guide users to use separate flutter - // library for geolocation or implement separate method under - // [GoogleMapsNavigationSessionManager] to fetch the location - // using the [FusedLocationProviderApi]. - @Suppress("DEPRECATION") return getMap().myLocation - } - - fun getCameraPosition(): CameraPosition { - return getMap().cameraPosition ?: CameraPosition(LatLng(0.0, 0.0), 0.0F, 0.0F, 0.0F) - } - - fun getVisibleRegion(): LatLngBounds { - return getMap().projection.visibleRegion.latLngBounds - } - - private fun getMapCallback(callback: (Result) -> Unit): GoogleMap.CancelableCallback { - return object : GoogleMap.CancelableCallback { - override fun onFinish() { - callback(Result.success(true)) - } - - override fun onCancel() { - callback(Result.success(false)) - } - } - } - - private fun animateCamera( - cameraUpdate: CameraUpdate, - duration: Long?, - callback: (Result) -> Unit - ) { - // Native animateCamera() doesn't allow setting null duration so need to do two calls - if (duration == null) { - getMap().animateCamera(cameraUpdate, getMapCallback(callback)) - } else { - getMap().animateCamera(cameraUpdate, duration.toInt(), getMapCallback(callback)) - } - } - - fun animateCameraToCameraPosition( - cameraPosition: CameraPosition, - duration: Long?, - callback: (Result) -> Unit - ) { - animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), duration, callback) - } - - fun animateCameraToLatLng(point: LatLng, duration: Long?, callback: (Result) -> Unit) { - animateCamera(CameraUpdateFactory.newLatLng(point), duration, callback) - } - - fun animateCameraToLatLngBounds( - bounds: LatLngBounds, - padding: Double, - duration: Long?, - callback: (Result) -> Unit - ) { - animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding.toInt()), duration, callback) - } - - fun animateCameraToLatLngZoom( - point: LatLng, - zoom: Double, - duration: Long?, - callback: (Result) -> Unit - ) { - animateCamera(CameraUpdateFactory.newLatLngZoom(point, zoom.toFloat()), duration, callback) - } - - fun animateCameraByScroll( - scrollByDx: Double, - scrollByDy: Double, - duration: Long?, - callback: (Result) -> Unit - ) { - animateCamera( - CameraUpdateFactory.scrollBy(scrollByDx.toFloat(), scrollByDy.toFloat()), - duration, - callback - ) - } - - fun animateCameraByZoom( - zoomBy: Double, - focus: Point?, - duration: Long?, - callback: (Result) -> Unit - ) { - // Native animateCamera() doesn't allow setting null duration or focus so need to split to - // multiple calls - val cameraUpdate = - if (focus != null) { - CameraUpdateFactory.zoomBy(zoomBy.toFloat(), focus) - } else { - CameraUpdateFactory.zoomBy(zoomBy.toFloat()) - } - animateCamera(cameraUpdate, duration, callback) - } - - fun animateCameraToZoom(zoom: Double, duration: Long?, callback: (Result) -> Unit) { - animateCamera(CameraUpdateFactory.zoomTo(zoom.toFloat()), duration, callback) - } - - fun moveCameraToCameraPosition(cameraPosition: CameraPosition) { - return getMap().moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) - } - - fun moveCameraToLatLng(point: LatLng) { - return getMap().moveCamera(CameraUpdateFactory.newLatLng(point)) - } - - fun moveCameraToLatLngBounds(bounds: LatLngBounds, padding: Double) { - return getMap().moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding.toInt())) - } - - fun moveCameraToLatLngZoom(point: LatLng, zoom: Double) { - return getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(point, zoom.toFloat())) - } - - fun moveCameraByScroll(scrollByDx: Double, scrollByDy: Double) { - return getMap() - .moveCamera(CameraUpdateFactory.scrollBy(scrollByDx.toFloat(), scrollByDy.toFloat())) - } - - fun moveCameraByZoom(zoomBy: Double, focus: Point?) { - if (focus != null) { - getMap().moveCamera(CameraUpdateFactory.zoomBy(zoomBy.toFloat(), focus)) - } else { - getMap().moveCamera(CameraUpdateFactory.zoomBy(zoomBy.toFloat())) + override fun initListeners() { + _navigationView.addOnRecenterButtonClickedListener { + viewEventApi.onRecenterButtonClicked(viewId.toLong()) {} } - } - - fun moveCameraToZoom(zoom: Double) { - return getMap().moveCamera(CameraUpdateFactory.zoomTo(zoom.toFloat())) - } - - fun getMapType(): Int { - return getMap().mapType - } - - fun setMapType(mapType: Int) { - invalidateViewAfterMapLoad() - getMap().mapType = mapType - } - - fun setMapStyle(styleJson: String) { - invalidateViewAfterMapLoad() - if (!getMap().setMapStyle(MapStyleOptions(styleJson))) { - throw FlutterError("mapStyleError", "Failed to set map style") + _navigationView.addOnNavigationUiChangedListener { + viewEventApi.onNavigationUIEnabledChanged(viewId.toLong(), it) {} } + super.initListeners() } fun isNavigationTripProgressBarEnabled(): Boolean { return _isNavigationTripProgressBarEnabled } - @SuppressLint("MissingPermission") - fun followMyLocation(perspective: Int, zoomLevel: Double?) { - invalidateViewAfterMapLoad() - getMap().followMyLocation(perspective) - if (zoomLevel != null) { - val options: FollowMyLocationOptions = - FollowMyLocationOptions.builder().setZoomLevel(zoomLevel.toFloat()).build() - getMap().followMyLocation(perspective, options) - } else { - getMap().followMyLocation(perspective) - } - } - fun setNavigationTripProgressBarEnabled(enabled: Boolean) { invalidateViewAfterMapLoad() _navigationView.setTripProgressBarEnabled(enabled) @@ -730,392 +230,4 @@ internal constructor( invalidateViewAfterMapLoad() _navigationView.showRouteOverview() } - - fun getMinZoomPreference(): Float { - return _minZoomLevelPreference ?: getMap().minZoomLevel - } - - fun getMaxZoomPreference(): Float { - return _maxZoomLevelPreference ?: getMap().maxZoomLevel - } - - fun resetMinMaxZoomPreference() { - _minZoomLevelPreference = null - _maxZoomLevelPreference = null - getMap().resetMinMaxZoomPreference() - } - - @Throws(FlutterError::class) - fun setMinZoomPreference(minZoomPreference: Float) { - if (minZoomPreference > (_maxZoomLevelPreference ?: getMap().maxZoomLevel)) { - throw FlutterError( - "minZoomGreaterThanMaxZoom", - "Minimum zoom level cannot be greater than maximum zoom level" - ) - } - - _minZoomLevelPreference = minZoomPreference - getMap().setMinZoomPreference(minZoomPreference) - } - - @Throws(FlutterError::class) - fun setMaxZoomPreference(maxZoomPreference: Float) { - if (maxZoomPreference < (_minZoomLevelPreference ?: getMap().minZoomLevel)) { - throw FlutterError( - "maxZoomLessThanMinZoom", - "Maximum zoom level cannot be less than minimum zoom level" - ) - } - - _maxZoomLevelPreference = maxZoomPreference - getMap().setMaxZoomPreference(maxZoomPreference) - } - - fun awaitMapReady(callback: (Result) -> Unit) { - if (_map != null) { - // Call the callback immediately as the map is already initialized - callback(Result.success(Unit)) - } else if (_mapReadyCallback != null) { - // If there is already a callback pending, throw an error to avoid overriding it - callback( - Result.failure( - FlutterError( - "mapReadyCallbackAlreadyPending", - "A callback is already pending and cannot be overridden." - ) - ) - ) - } else { - // Save the callback to be called once the map is initialized - _mapReadyCallback = callback - } - } - - fun getMarkers(): List { - return _markers.map { MarkerDto(it.markerId, Convert.markerControllerToMarkerOptions(it)) } - } - - fun addMarkers(markers: List): List { - val result = mutableListOf() - markers.forEach { - val builder = MarkerBuilder() - Convert.sinkMarkerOptions(it.options, builder, imageRegistry) - val options = builder.build() - val marker = getMap().addMarker(options) - if (marker != null) { - val registeredImage = - it.options.icon.registeredImageId?.let { id -> imageRegistry.findRegisteredImage(id) } - val controller = - MarkerController( - marker, - it.markerId, - builder.consumeTapEvents, - it.options.anchor.u.toFloat(), - it.options.anchor.v.toFloat(), - it.options.infoWindow.anchor.u.toFloat(), - it.options.infoWindow.anchor.v.toFloat(), - registeredImage - ) - _markers.add(controller) - result.add(it) - } - } - // Double invalidate map view. Marker icon updates seem to take extra - // time and some times icon did not update properly after single invalidate. - invalidateViewAfterMapLoad(true) - return result - } - - @Throws(FlutterError::class) - fun updateMarkers(markers: List): List { - val result = mutableListOf() - var error: Throwable? = null - markers.forEach { - findMarkerController(it.markerId)?.let { controller -> - Convert.sinkMarkerOptions(it.options, controller, imageRegistry) - result.add(it) - } - ?: run { - error = FlutterError("markerNotFound", "Failed to update marker with id ${it.markerId}") - } - } - error?.let { throw error as Throwable } - // Double invalidate map view. Marker icon updates seem to take extra - // time and some times icon did not update properly after single invalidate. - invalidateViewAfterMapLoad(true) - return result - } - - @Throws(FlutterError::class) - fun removeMarkers(markers: List) { - invalidateViewAfterMapLoad() - var error: Throwable? = null - markers.forEach { - findMarkerController(it.markerId)?.let { controller -> - controller.remove() - _markers.remove(controller) - } - ?: run { - error = FlutterError("markerNotFound", "Failed to remove marker with id ${it.markerId}") - } - } - error?.let { throw error as Throwable } - } - - fun clearMarkers() { - invalidateViewAfterMapLoad() - _markers.forEach { controller -> controller.remove() } - _markers.clear() - } - - fun clear() { - getMap().clear() - _markers.clear() - _polygons.clear() - _polylines.clear() - _circles.clear() - } - - fun getPolygons(): List { - val density = Resources.getSystem().displayMetrics.density - return _polygons.map { - PolygonDto(it.polygonId, Convert.polygonToPolygonOptions(it.polygon, density)) - } - } - - fun addPolygons( - polygons: List, - ): List { - val density = Resources.getSystem().displayMetrics.density - invalidateViewAfterMapLoad() - val result = mutableListOf() - polygons.forEach { - val builder = PolygonBuilder() - Convert.sinkPolygonOptions(it.options, builder, density) - val options = builder.build() - val polygon = getMap().addPolygon(options) - if (polygon != null) { - val controller = PolygonController(polygon, it.polygonId) - _polygons.add(controller) - result.add(it) - } - } - return result - } - - fun updatePolygons(polygons: List): List { - invalidateViewAfterMapLoad() - var error: Throwable? = null - val result = mutableListOf() - val density = Resources.getSystem().displayMetrics.density - polygons.forEach { - findPolygonController(it.polygonId)?.let { controller -> - Convert.sinkPolygonOptions(it.options, controller, density) - result.add(it) - } - ?: run { - error = - FlutterError("polygonNotFound", "Failed to update polygon with id ${it.polygonId}") - } - } - error?.let { throw error as Throwable } - - return result - } - - fun removePolygons(polygons: List) { - invalidateViewAfterMapLoad() - var error: Throwable? = null - polygons.forEach { - findPolygonController(it.polygonId)?.let { controller -> - controller.remove() - _polygons.remove(controller) - } - ?: run { - error = - FlutterError("polygonNotFound", "Failed to remove polygon with id ${it.polygonId}") - } - } - error?.let { throw error as Throwable } - } - - fun clearPolygons() { - invalidateViewAfterMapLoad() - _polygons.forEach { controller -> controller.remove() } - _polygons.clear() - } - - fun getPolylines(): List { - val density = Resources.getSystem().displayMetrics.density - return _polylines.map { - PolylineDto(it.polylineId, Convert.polylineToPolylineOptions(it.polyline, density)) - } - } - - fun addPolylines( - polylines: List, - ): List { - val density = Resources.getSystem().displayMetrics.density - invalidateViewAfterMapLoad() - val result = mutableListOf() - polylines.forEach { - val builder = PolylineBuilder() - Convert.sinkPolylineOptions(it.options, builder, density) - val options = builder.build() - val polyline = getMap().addPolyline(options) - if (polyline != null) { - val controller = PolylineController(polyline, it.polylineId) - _polylines.add(controller) - result.add(it) - } - } - return result - } - - fun updatePolylines(polylines: List): List { - var error: Throwable? = null - val density = Resources.getSystem().displayMetrics.density - invalidateViewAfterMapLoad() - val result = mutableListOf() - polylines.forEach { - findPolylineController(it.polylineId)?.let { controller -> - Convert.sinkPolylineOptions(it.options, controller, density) - result.add(it) - } - ?: run { - error = - FlutterError("polylineNotFound", "Failed to update polyline with id ${it.polylineId}") - } - } - error?.let { throw error as Throwable } - return result - } - - fun removePolylines(polylines: List) { - invalidateViewAfterMapLoad() - var error: Throwable? = null - polylines.forEach { - findPolylineController(it.polylineId)?.let { controller -> - controller.remove() - _polylines.remove(controller) - } - ?: run { - error = - FlutterError("polylineNotFound", "Failed to remove polyline with id ${it.polylineId}") - } - } - error?.let { throw error as Throwable } - } - - fun clearPolylines() { - invalidateViewAfterMapLoad() - _polylines.forEach { controller -> controller.remove() } - _polylines.clear() - } - - fun getCircles(): List { - val density = Resources.getSystem().displayMetrics.density - return _circles.map { - CircleDto(it.circleId, Convert.circleToCircleOptions(it.circle, density)) - } - } - - fun addCircles(circles: List): List { - val density = Resources.getSystem().displayMetrics.density - invalidateViewAfterMapLoad() - val result = mutableListOf() - circles.forEach { - val builder = CircleBuilder() - Convert.sinkCircleOptions(it.options, builder, density) - val options = builder.build() - val circle = getMap().addCircle(options) - if (circle != null) { - val controller = CircleController(circle, it.circleId) - _circles.add(controller) - result.add(it) - } - } - return result - } - - fun updateCircles(circles: List): List { - val density = Resources.getSystem().displayMetrics.density - invalidateViewAfterMapLoad() - val result = mutableListOf() - var error: Throwable? = null - circles.forEach { - findCircleController(it.circleId)?.let { controller -> - Convert.sinkCircleOptions(it.options, controller, density) - result.add(it) - } - ?: run { - error = FlutterError("circleNotFound", "Failed to update circle with id ${it.circleId}") - } - } - error?.let { throw error as Throwable } - return result - } - - fun removeCircles(circles: List) { - invalidateViewAfterMapLoad() - var error: Throwable? = null - circles.forEach { - findCircleController(it.circleId)?.let { controller -> - controller.remove() - _circles.remove(controller) - } - ?: run { - error = FlutterError("circleNotFound", "Failed to remove circle with id ${it.circleId}") - } - } - error?.let { throw error as Throwable } - } - - fun clearCircles() { - invalidateViewAfterMapLoad() - _circles.forEach { controller -> controller.remove() } - _circles.clear() - } - - fun setConsumeMyLocationButtonClickEventsEnabled(enabled: Boolean) { - _consumeMyLocationButtonClickEventsEnabled = enabled - } - - fun isConsumeMyLocationButtonClickEventsEnabled(): Boolean { - return _consumeMyLocationButtonClickEventsEnabled - } - - fun registerOnCameraChangedListener() { - getMap().setOnCameraMoveStartedListener { reason -> - val event = - when (reason) { - OnCameraMoveStartedListener.REASON_API_ANIMATION, - OnCameraMoveStartedListener.REASON_DEVELOPER_ANIMATION -> - CameraEventTypeDto.MOVESTARTEDBYAPI - OnCameraMoveStartedListener.REASON_GESTURE -> CameraEventTypeDto.MOVESTARTEDBYGESTURE - else -> { - // This should not happen, added that the compiler does not complain. - throw RuntimeException("Unknown camera move started reason: $reason") - } - } - val position = Convert.convertCameraPositionToDto(getMap().cameraPosition) - navigationViewEventApi.onCameraChanged(viewId.toLong(), event, position) {} - } - getMap().setOnCameraMoveListener { - val position = Convert.convertCameraPositionToDto(getMap().cameraPosition) - navigationViewEventApi.onCameraChanged( - viewId.toLong(), - CameraEventTypeDto.ONCAMERAMOVE, - position - ) {} - } - getMap().setOnCameraIdleListener { - val position = Convert.convertCameraPositionToDto(getMap().cameraPosition) - navigationViewEventApi.onCameraChanged( - viewId.toLong(), - CameraEventTypeDto.ONCAMERAIDLE, - position - ) {} - } - } } diff --git a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationViewRegistry.kt b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationViewRegistry.kt deleted file mode 100644 index 53c3701..0000000 --- a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationViewRegistry.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2023 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.maps.flutter.navigation - -import android.content.ComponentCallbacks -import android.content.ComponentCallbacks2 -import android.content.res.Configuration -import android.util.SparseArray -import androidx.core.util.forEach -import androidx.lifecycle.DefaultLifecycleObserver -import androidx.lifecycle.LifecycleOwner - -/** GoogleMapsNavigationViewRegistry */ -class GoogleMapsNavigationViewRegistry : - DefaultLifecycleObserver, ComponentCallbacks, ComponentCallbacks2 { - private val views: SparseArray = SparseArray() - - fun registerView(viewId: Int, view: GoogleMapsNavigationView) { - views.put(viewId, view) - } - - fun unregisterView(viewId: Int) { - views.remove(viewId) - } - - fun getView(viewId: Int): GoogleMapsNavigationView? { - return views.get(viewId) - } - - override fun onStart(owner: LifecycleOwner) { - views.forEach { _, view -> view.onStart() } - } - - override fun onResume(owner: LifecycleOwner) { - views.forEach { _, view -> view.onResume() } - } - - override fun onPause(owner: LifecycleOwner) { - views.forEach { _, view -> view.onPause() } - } - - override fun onStop(owner: LifecycleOwner) { - views.forEach { _, view -> view.onStop() } - } - - override fun onConfigurationChanged(configuration: Configuration) { - views.forEach { _, view -> view.onConfigurationChanged(configuration) } - } - - override fun onLowMemory() { - // Ignored as NavigationView only supports onTrimMemory - } - - override fun onTrimMemory(level: Int) { - views.forEach { _, view -> view.onTrimMemory(level) } - } -} diff --git a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationViewFactory.kt b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsViewFactory.kt similarity index 60% rename from android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationViewFactory.kt rename to android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsViewFactory.kt index 06fed76..3776ac1 100644 --- a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationViewFactory.kt +++ b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsViewFactory.kt @@ -21,24 +21,28 @@ import io.flutter.plugin.common.StandardMessageCodec import io.flutter.plugin.platform.PlatformView import io.flutter.plugin.platform.PlatformViewFactory -class GoogleMapsNavigationViewFactory( - private val viewRegistry: GoogleMapsNavigationViewRegistry, - private val navigationViewEventApi: NavigationViewEventApi, +class GoogleMapsViewFactory( + private val viewRegistry: GoogleMapsViewRegistry, + private val viewEventApi: ViewEventApi, private val imageRegistry: ImageRegistry ) : PlatformViewFactory(StandardMessageCodec.INSTANCE) { override fun create(context: Context, viewId: Int, args: Any?): PlatformView { - val params = NavigationViewCreationOptionsDto.fromList(args as List) + val params = ViewCreationOptionsDto.fromList(args as List) val mapOptions = Convert.convertMapOptionsFromDto(params.mapOptions) - val navigationViewOptions = - Convert.convertNavigationViewOptionsFromDto(params.navigationViewOptions) - return GoogleMapsNavigationView( - context, - mapOptions, - navigationViewOptions, - viewId, - viewRegistry, - navigationViewEventApi, - imageRegistry - ) + if (params.mapViewType == MapViewTypeDto.NAVIGATION) { + val navigationViewOptionsDto = + params.navigationViewOptions?.let { Convert.convertNavigationViewOptionsFromDto(it) } + return GoogleMapsNavigationView( + context, + mapOptions, + navigationViewOptionsDto, + viewId, + viewRegistry, + viewEventApi, + imageRegistry + ) + } else { + return GoogleMapView(context, mapOptions, viewId, viewEventApi, viewRegistry, imageRegistry) + } } } diff --git a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationViewMessageHandler.kt b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsViewMessageHandler.kt similarity index 88% rename from android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationViewMessageHandler.kt rename to android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsViewMessageHandler.kt index c71c735..a77c661 100644 --- a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsNavigationViewMessageHandler.kt +++ b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsViewMessageHandler.kt @@ -18,12 +18,20 @@ package com.google.maps.flutter.navigation import android.content.res.Resources -/** GoogleMapsNavigationMessageHandler */ -class GoogleMapsNavigationViewMessageHandler( - private val viewRegistry: GoogleMapsNavigationViewRegistry -) : NavigationViewApi { - private fun getView(viewId: Int): GoogleMapsNavigationView { - val view = viewRegistry.getView(viewId) +/** GoogleMapsViewMessageHandler */ +class GoogleMapsViewMessageHandler(private val viewRegistry: GoogleMapsViewRegistry) : MapViewApi { + + private fun getNavigationView(viewId: Int): GoogleMapsNavigationView { + val view = viewRegistry.getNavigationView(viewId) + if (view != null) { + return view + } else { + throw FlutterError("viewNotFound", "No valid navigation view found") + } + } + + private fun getView(viewId: Int): GoogleMapsBaseMapView { + val view = viewRegistry.getMapView(viewId) if (view != null) { return view } else { @@ -284,7 +292,7 @@ class GoogleMapsNavigationViewMessageHandler( } override fun isNavigationTripProgressBarEnabled(viewId: Long): Boolean { - return getView(viewId.toInt()).isNavigationTripProgressBarEnabled() + return getNavigationView(viewId.toInt()).isNavigationTripProgressBarEnabled() } override fun followMyLocation( @@ -292,72 +300,72 @@ class GoogleMapsNavigationViewMessageHandler( perspective: CameraPerspectiveDto, zoomLevel: Double? ) { - val view = viewRegistry.getView(viewId.toInt()) + val view = viewRegistry.getMapView(viewId.toInt()) view?.followMyLocation(Convert.convertCameraPerspectiveFromDto(perspective), zoomLevel) } override fun setNavigationTripProgressBarEnabled(viewId: Long, enabled: Boolean) { - getView(viewId.toInt()).setNavigationTripProgressBarEnabled(enabled) + getNavigationView(viewId.toInt()).setNavigationTripProgressBarEnabled(enabled) } override fun isNavigationHeaderEnabled(viewId: Long): Boolean { - return getView(viewId.toInt()).isNavigationHeaderEnabled() + return getNavigationView(viewId.toInt()).isNavigationHeaderEnabled() } override fun setNavigationHeaderEnabled(viewId: Long, enabled: Boolean) { - getView(viewId.toInt()).setNavigationHeaderEnabled(enabled) + getNavigationView(viewId.toInt()).setNavigationHeaderEnabled(enabled) } override fun isNavigationFooterEnabled(viewId: Long): Boolean { - return getView(viewId.toInt()).isNavigationFooterEnabled() + return getNavigationView(viewId.toInt()).isNavigationFooterEnabled() } override fun setNavigationFooterEnabled(viewId: Long, enabled: Boolean) { - getView(viewId.toInt()).setNavigationFooterEnabled(enabled) + getNavigationView(viewId.toInt()).setNavigationFooterEnabled(enabled) } override fun isRecenterButtonEnabled(viewId: Long): Boolean { - return getView(viewId.toInt()).isRecenterButtonEnabled() + return getNavigationView(viewId.toInt()).isRecenterButtonEnabled() } override fun setRecenterButtonEnabled(viewId: Long, enabled: Boolean) { - getView(viewId.toInt()).setRecenterButtonEnabled(enabled) + getNavigationView(viewId.toInt()).setRecenterButtonEnabled(enabled) } override fun isSpeedLimitIconEnabled(viewId: Long): Boolean { - return getView(viewId.toInt()).isSpeedLimitIconEnabled() + return getNavigationView(viewId.toInt()).isSpeedLimitIconEnabled() } override fun setSpeedLimitIconEnabled(viewId: Long, enabled: Boolean) { - getView(viewId.toInt()).setSpeedLimitIconEnabled(enabled) + getNavigationView(viewId.toInt()).setSpeedLimitIconEnabled(enabled) } override fun isSpeedometerEnabled(viewId: Long): Boolean { - return getView(viewId.toInt()).isSpeedometerEnabled() + return getNavigationView(viewId.toInt()).isSpeedometerEnabled() } override fun setSpeedometerEnabled(viewId: Long, enabled: Boolean) { - getView(viewId.toInt()).setSpeedometerEnabled(enabled) + getNavigationView(viewId.toInt()).setSpeedometerEnabled(enabled) } override fun isTrafficIncidentCardsEnabled(viewId: Long): Boolean { - return getView(viewId.toInt()).isTrafficIncidentCardsEnabled() + return getNavigationView(viewId.toInt()).isTrafficIncidentCardsEnabled() } override fun setTrafficIncidentCardsEnabled(viewId: Long, enabled: Boolean) { - getView(viewId.toInt()).setTrafficIncidentCardsEnabled(enabled) + getNavigationView(viewId.toInt()).setTrafficIncidentCardsEnabled(enabled) } override fun isNavigationUIEnabled(viewId: Long): Boolean { - return getView(viewId.toInt()).isNavigationUIEnabled() + return getNavigationView(viewId.toInt()).isNavigationUIEnabled() } override fun setNavigationUIEnabled(viewId: Long, enabled: Boolean) { - getView(viewId.toInt()).setNavigationUIEnabled(enabled) + getNavigationView(viewId.toInt()).setNavigationUIEnabled(enabled) } override fun showRouteOverview(viewId: Long) { - getView(viewId.toInt()).showRouteOverview() + getNavigationView(viewId.toInt()).showRouteOverview() } override fun getMinZoomPreference(viewId: Long): Double { diff --git a/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsViewRegistry.kt b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsViewRegistry.kt new file mode 100644 index 0000000..bda737c --- /dev/null +++ b/android/src/main/kotlin/com/google/maps/flutter/navigation/GoogleMapsViewRegistry.kt @@ -0,0 +1,91 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.maps.flutter.navigation + +import android.content.ComponentCallbacks +import android.content.ComponentCallbacks2 +import android.content.res.Configuration +import android.util.SparseArray +import androidx.core.util.forEach +import androidx.lifecycle.DefaultLifecycleObserver +import androidx.lifecycle.LifecycleOwner + +/** GoogleMapsNavigationViewRegistry */ +class GoogleMapsViewRegistry : DefaultLifecycleObserver, ComponentCallbacks, ComponentCallbacks2 { + // Separate lists for navigation views, to be able to access them separately for navigation only + // operations. + private val navigationViews: SparseArray = SparseArray() + + // This list contains all map views, including navigation views. + private val allMapViews: SparseArray = SparseArray() + + fun registerNavigationView(viewId: Int, view: GoogleMapsNavigationView) { + // Navigation views are added both lists. + navigationViews.put(viewId, view) + allMapViews.put(viewId, view) + } + + fun registerMapView(viewId: Int, view: GoogleMapsBaseMapView) { + allMapViews.put(viewId, view) + } + + fun unregisterNavigationView(viewId: Int) { + // Navigation views need to be removed from both lists. + navigationViews.remove(viewId) + allMapViews.remove(viewId) + } + + fun unregisterMapView(viewId: Int) { + allMapViews.remove(viewId) + } + + fun getNavigationView(viewId: Int): GoogleMapsNavigationView? { + return navigationViews.get(viewId) + } + + fun getMapView(viewId: Int): GoogleMapsBaseMapView? { + return allMapViews.get(viewId) + } + + override fun onStart(owner: LifecycleOwner) { + allMapViews.forEach { _, view -> view.onStart() } + } + + override fun onResume(owner: LifecycleOwner) { + allMapViews.forEach { _, view -> view.onResume() } + } + + override fun onPause(owner: LifecycleOwner) { + allMapViews.forEach { _, view -> view.onPause() } + } + + override fun onStop(owner: LifecycleOwner) { + allMapViews.forEach { _, view -> view.onStop() } + } + + override fun onConfigurationChanged(configuration: Configuration) { + navigationViews.forEach { _, view -> view.onConfigurationChanged(configuration) } + } + + override fun onLowMemory() { + // Ignored as NavigationView only supports onTrimMemory + } + + override fun onTrimMemory(level: Int) { + navigationViews.forEach { _, view -> view.onTrimMemory(level) } + } +} diff --git a/android/src/main/kotlin/com/google/maps/flutter/navigation/messages.g.kt b/android/src/main/kotlin/com/google/maps/flutter/navigation/messages.g.kt index 72efd2b..965b27a 100644 --- a/android/src/main/kotlin/com/google/maps/flutter/navigation/messages.g.kt +++ b/android/src/main/kotlin/com/google/maps/flutter/navigation/messages.g.kt @@ -62,6 +62,23 @@ class FlutterError( val details: Any? = null ) : Throwable() +/** Describes the type of map to construct. */ +enum class MapViewTypeDto(val raw: Int) { + /** + * Navigation view supports navigation overlay, and current navigation session is displayed on the + * map. + */ + NAVIGATION(0), + /** Classic map view, without navigation overlay. */ + MAP(1); + + companion object { + fun ofRaw(raw: Int): MapViewTypeDto? { + return values().firstOrNull { it.raw == raw } + } + } +} + /** Determines the initial visibility of the navigation UI on map initialization. */ enum class NavigationUIEnabledPreferenceDto(val raw: Int) { /** Navigation UI gets enabled if the navigation session has already been successfully started. */ @@ -611,23 +628,27 @@ data class NavigationViewOptionsDto( * * Generated class from Pigeon that represents data sent in messages. */ -data class NavigationViewCreationOptionsDto( +data class ViewCreationOptionsDto( + val mapViewType: MapViewTypeDto, val mapOptions: MapOptionsDto, - val navigationViewOptions: NavigationViewOptionsDto + val navigationViewOptions: NavigationViewOptionsDto? = null ) { companion object { @Suppress("UNCHECKED_CAST") - fun fromList(list: List): NavigationViewCreationOptionsDto { - val mapOptions = MapOptionsDto.fromList(list[0] as List) - val navigationViewOptions = NavigationViewOptionsDto.fromList(list[1] as List) - return NavigationViewCreationOptionsDto(mapOptions, navigationViewOptions) + fun fromList(list: List): ViewCreationOptionsDto { + val mapViewType = MapViewTypeDto.ofRaw(list[0] as Int)!! + val mapOptions = MapOptionsDto.fromList(list[1] as List) + val navigationViewOptions: NavigationViewOptionsDto? = + (list[2] as List?)?.let { NavigationViewOptionsDto.fromList(it) } + return ViewCreationOptionsDto(mapViewType, mapOptions, navigationViewOptions) } } fun toList(): List { return listOf( + mapViewType.raw, mapOptions.toList(), - navigationViewOptions.toList(), + navigationViewOptions?.toList(), ) } } @@ -1770,12 +1791,10 @@ private object _NavigationViewCreationApiCodec : StandardMessageCodec() { return (readValue(buffer) as? List)?.let { MapOptionsDto.fromList(it) } } 132.toByte() -> { - return (readValue(buffer) as? List)?.let { - NavigationViewCreationOptionsDto.fromList(it) - } + return (readValue(buffer) as? List)?.let { NavigationViewOptionsDto.fromList(it) } } 133.toByte() -> { - return (readValue(buffer) as? List)?.let { NavigationViewOptionsDto.fromList(it) } + return (readValue(buffer) as? List)?.let { ViewCreationOptionsDto.fromList(it) } } else -> super.readValueOfType(type, buffer) } @@ -1799,11 +1818,11 @@ private object _NavigationViewCreationApiCodec : StandardMessageCodec() { stream.write(131) writeValue(stream, value.toList()) } - is NavigationViewCreationOptionsDto -> { + is NavigationViewOptionsDto -> { stream.write(132) writeValue(stream, value.toList()) } - is NavigationViewOptionsDto -> { + is ViewCreationOptionsDto -> { stream.write(133) writeValue(stream, value.toList()) } @@ -1820,7 +1839,7 @@ private object _NavigationViewCreationApiCodec : StandardMessageCodec() { * Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface _NavigationViewCreationApi { - fun _create(msg: NavigationViewCreationOptionsDto) + fun _create(msg: ViewCreationOptionsDto) companion object { /** The codec used by _NavigationViewCreationApi. */ @@ -1841,7 +1860,7 @@ interface _NavigationViewCreationApi { if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val msgArg = args[0] as NavigationViewCreationOptionsDto + val msgArg = args[0] as ViewCreationOptionsDto var wrapped: List try { api._create(msgArg) @@ -1860,7 +1879,7 @@ interface _NavigationViewCreationApi { } @Suppress("UNCHECKED_CAST") -private object NavigationViewApiCodec : StandardMessageCodec() { +private object MapViewApiCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 128.toByte() -> { @@ -2008,7 +2027,7 @@ private object NavigationViewApiCodec : StandardMessageCodec() { } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ -interface NavigationViewApi { +interface MapViewApi { fun awaitMapReady(viewId: Long, callback: (Result) -> Unit) fun isMyLocationEnabled(viewId: Long): Boolean @@ -2230,18 +2249,16 @@ interface NavigationViewApi { fun registerOnCameraChangedListener(viewId: Long) companion object { - /** The codec used by NavigationViewApi. */ - val codec: MessageCodec by lazy { NavigationViewApiCodec } - /** - * Sets up an instance of `NavigationViewApi` to handle messages through the `binaryMessenger`. - */ + /** The codec used by MapViewApi. */ + val codec: MessageCodec by lazy { MapViewApiCodec } + /** Sets up an instance of `MapViewApi` to handle messages through the `binaryMessenger`. */ @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: NavigationViewApi?) { + fun setUp(binaryMessenger: BinaryMessenger, api: MapViewApi?) { run { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.awaitMapReady", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.awaitMapReady", codec ) if (api != null) { @@ -2265,7 +2282,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMyLocationEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMyLocationEnabled", codec ) if (api != null) { @@ -2288,7 +2305,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationEnabled", codec ) if (api != null) { @@ -2313,7 +2330,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMyLocation", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMyLocation", codec ) if (api != null) { @@ -2336,7 +2353,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMapType", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMapType", codec ) if (api != null) { @@ -2359,7 +2376,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapType", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapType", codec ) if (api != null) { @@ -2384,7 +2401,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapStyle", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapStyle", codec ) if (api != null) { @@ -2409,7 +2426,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationTripProgressBarEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationTripProgressBarEnabled", codec ) if (api != null) { @@ -2432,7 +2449,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationTripProgressBarEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationTripProgressBarEnabled", codec ) if (api != null) { @@ -2457,7 +2474,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationHeaderEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationHeaderEnabled", codec ) if (api != null) { @@ -2480,7 +2497,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationHeaderEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationHeaderEnabled", codec ) if (api != null) { @@ -2505,7 +2522,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationFooterEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationFooterEnabled", codec ) if (api != null) { @@ -2528,7 +2545,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationFooterEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationFooterEnabled", codec ) if (api != null) { @@ -2553,7 +2570,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isRecenterButtonEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isRecenterButtonEnabled", codec ) if (api != null) { @@ -2576,7 +2593,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRecenterButtonEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRecenterButtonEnabled", codec ) if (api != null) { @@ -2601,7 +2618,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isSpeedLimitIconEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isSpeedLimitIconEnabled", codec ) if (api != null) { @@ -2624,7 +2641,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedLimitIconEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedLimitIconEnabled", codec ) if (api != null) { @@ -2649,7 +2666,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isSpeedometerEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isSpeedometerEnabled", codec ) if (api != null) { @@ -2672,7 +2689,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedometerEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedometerEnabled", codec ) if (api != null) { @@ -2697,7 +2714,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTrafficIncidentCardsEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTrafficIncidentCardsEnabled", codec ) if (api != null) { @@ -2720,7 +2737,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficIncidentCardsEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficIncidentCardsEnabled", codec ) if (api != null) { @@ -2745,7 +2762,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationUIEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationUIEnabled", codec ) if (api != null) { @@ -2768,7 +2785,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationUIEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationUIEnabled", codec ) if (api != null) { @@ -2793,7 +2810,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getCameraPosition", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getCameraPosition", codec ) if (api != null) { @@ -2816,7 +2833,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getVisibleRegion", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getVisibleRegion", codec ) if (api != null) { @@ -2839,7 +2856,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.followMyLocation", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.followMyLocation", codec ) if (api != null) { @@ -2865,7 +2882,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToCameraPosition", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToCameraPosition", codec ) if (api != null) { @@ -2893,7 +2910,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLng", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLng", codec ) if (api != null) { @@ -2920,7 +2937,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngBounds", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngBounds", codec ) if (api != null) { @@ -2949,7 +2966,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngZoom", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngZoom", codec ) if (api != null) { @@ -2978,7 +2995,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByScroll", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByScroll", codec ) if (api != null) { @@ -3007,7 +3024,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByZoom", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByZoom", codec ) if (api != null) { @@ -3037,7 +3054,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToZoom", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToZoom", codec ) if (api != null) { @@ -3064,7 +3081,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToCameraPosition", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToCameraPosition", codec ) if (api != null) { @@ -3089,7 +3106,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLng", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLng", codec ) if (api != null) { @@ -3114,7 +3131,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngBounds", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngBounds", codec ) if (api != null) { @@ -3140,7 +3157,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngZoom", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngZoom", codec ) if (api != null) { @@ -3166,7 +3183,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByScroll", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByScroll", codec ) if (api != null) { @@ -3192,7 +3209,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByZoom", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByZoom", codec ) if (api != null) { @@ -3219,7 +3236,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToZoom", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToZoom", codec ) if (api != null) { @@ -3244,7 +3261,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.showRouteOverview", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.showRouteOverview", codec ) if (api != null) { @@ -3268,7 +3285,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMinZoomPreference", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMinZoomPreference", codec ) if (api != null) { @@ -3291,7 +3308,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMaxZoomPreference", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMaxZoomPreference", codec ) if (api != null) { @@ -3314,7 +3331,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.resetMinMaxZoomPreference", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.resetMinMaxZoomPreference", codec ) if (api != null) { @@ -3338,7 +3355,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMinZoomPreference", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMinZoomPreference", codec ) if (api != null) { @@ -3363,7 +3380,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMaxZoomPreference", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMaxZoomPreference", codec ) if (api != null) { @@ -3388,7 +3405,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationButtonEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationButtonEnabled", codec ) if (api != null) { @@ -3413,7 +3430,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setConsumeMyLocationButtonClickEventsEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setConsumeMyLocationButtonClickEventsEnabled", codec ) if (api != null) { @@ -3438,7 +3455,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomGesturesEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomGesturesEnabled", codec ) if (api != null) { @@ -3463,7 +3480,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomControlsEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomControlsEnabled", codec ) if (api != null) { @@ -3488,7 +3505,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setCompassEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setCompassEnabled", codec ) if (api != null) { @@ -3513,7 +3530,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRotateGesturesEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRotateGesturesEnabled", codec ) if (api != null) { @@ -3538,7 +3555,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesEnabled", codec ) if (api != null) { @@ -3563,7 +3580,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesDuringRotateOrZoomEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesDuringRotateOrZoomEnabled", codec ) if (api != null) { @@ -3588,7 +3605,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTiltGesturesEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTiltGesturesEnabled", codec ) if (api != null) { @@ -3613,7 +3630,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapToolbarEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapToolbarEnabled", codec ) if (api != null) { @@ -3638,7 +3655,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficEnabled", codec ) if (api != null) { @@ -3663,7 +3680,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMyLocationButtonEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMyLocationButtonEnabled", codec ) if (api != null) { @@ -3686,7 +3703,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isConsumeMyLocationButtonClickEventsEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isConsumeMyLocationButtonClickEventsEnabled", codec ) if (api != null) { @@ -3709,7 +3726,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isZoomGesturesEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isZoomGesturesEnabled", codec ) if (api != null) { @@ -3732,7 +3749,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isZoomControlsEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isZoomControlsEnabled", codec ) if (api != null) { @@ -3755,7 +3772,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isCompassEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isCompassEnabled", codec ) if (api != null) { @@ -3778,7 +3795,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isRotateGesturesEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isRotateGesturesEnabled", codec ) if (api != null) { @@ -3801,7 +3818,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isScrollGesturesEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isScrollGesturesEnabled", codec ) if (api != null) { @@ -3824,7 +3841,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isScrollGesturesEnabledDuringRotateOrZoom", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isScrollGesturesEnabledDuringRotateOrZoom", codec ) if (api != null) { @@ -3847,7 +3864,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTiltGesturesEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTiltGesturesEnabled", codec ) if (api != null) { @@ -3870,7 +3887,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMapToolbarEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMapToolbarEnabled", codec ) if (api != null) { @@ -3893,7 +3910,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTrafficEnabled", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTrafficEnabled", codec ) if (api != null) { @@ -3916,7 +3933,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMarkers", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMarkers", codec ) if (api != null) { @@ -3939,7 +3956,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addMarkers", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addMarkers", codec ) if (api != null) { @@ -3963,7 +3980,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateMarkers", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateMarkers", codec ) if (api != null) { @@ -3987,7 +4004,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeMarkers", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeMarkers", codec ) if (api != null) { @@ -4012,7 +4029,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearMarkers", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearMarkers", codec ) if (api != null) { @@ -4036,7 +4053,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clear", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clear", codec ) if (api != null) { @@ -4060,7 +4077,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getPolygons", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getPolygons", codec ) if (api != null) { @@ -4083,7 +4100,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolygons", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolygons", codec ) if (api != null) { @@ -4107,7 +4124,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolygons", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolygons", codec ) if (api != null) { @@ -4131,7 +4148,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolygons", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolygons", codec ) if (api != null) { @@ -4156,7 +4173,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearPolygons", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearPolygons", codec ) if (api != null) { @@ -4180,7 +4197,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getPolylines", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getPolylines", codec ) if (api != null) { @@ -4203,7 +4220,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolylines", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolylines", codec ) if (api != null) { @@ -4227,7 +4244,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolylines", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolylines", codec ) if (api != null) { @@ -4251,7 +4268,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolylines", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolylines", codec ) if (api != null) { @@ -4276,7 +4293,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearPolylines", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearPolylines", codec ) if (api != null) { @@ -4300,7 +4317,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getCircles", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getCircles", codec ) if (api != null) { @@ -4323,7 +4340,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addCircles", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addCircles", codec ) if (api != null) { @@ -4347,7 +4364,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateCircles", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateCircles", codec ) if (api != null) { @@ -4371,7 +4388,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeCircles", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeCircles", codec ) if (api != null) { @@ -4396,7 +4413,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearCircles", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearCircles", codec ) if (api != null) { @@ -4420,7 +4437,7 @@ interface NavigationViewApi { val channel = BasicMessageChannel( binaryMessenger, - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.registerOnCameraChangedListener", + "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.registerOnCameraChangedListener", codec ) if (api != null) { @@ -4605,7 +4622,7 @@ interface ImageRegistryApi { } @Suppress("UNCHECKED_CAST") -private object NavigationViewEventApiCodec : StandardMessageCodec() { +private object ViewEventApiCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 128.toByte() -> { @@ -4635,15 +4652,14 @@ private object NavigationViewEventApiCodec : StandardMessageCodec() { /** Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ @Suppress("UNCHECKED_CAST") -class NavigationViewEventApi(private val binaryMessenger: BinaryMessenger) { +class ViewEventApi(private val binaryMessenger: BinaryMessenger) { companion object { - /** The codec used by NavigationViewEventApi. */ - val codec: MessageCodec by lazy { NavigationViewEventApiCodec } + /** The codec used by ViewEventApi. */ + val codec: MessageCodec by lazy { ViewEventApiCodec } } fun onMapClickEvent(viewIdArg: Long, latLngArg: LatLngDto, callback: (Result) -> Unit) { - val channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMapClickEvent" + val channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMapClickEvent" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(viewIdArg, latLngArg)) { if (it is List<*>) { @@ -4660,7 +4676,7 @@ class NavigationViewEventApi(private val binaryMessenger: BinaryMessenger) { fun onMapLongClickEvent(viewIdArg: Long, latLngArg: LatLngDto, callback: (Result) -> Unit) { val channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMapLongClickEvent" + "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMapLongClickEvent" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(viewIdArg, latLngArg)) { if (it is List<*>) { @@ -4677,7 +4693,7 @@ class NavigationViewEventApi(private val binaryMessenger: BinaryMessenger) { fun onRecenterButtonClicked(viewIdArg: Long, callback: (Result) -> Unit) { val channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onRecenterButtonClicked" + "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onRecenterButtonClicked" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(viewIdArg)) { if (it is List<*>) { @@ -4698,8 +4714,7 @@ class NavigationViewEventApi(private val binaryMessenger: BinaryMessenger) { eventTypeArg: MarkerEventTypeDto, callback: (Result) -> Unit ) { - val channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerEvent" + val channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerEvent" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(viewIdArg, markerIdArg, eventTypeArg.raw)) { if (it is List<*>) { @@ -4721,8 +4736,7 @@ class NavigationViewEventApi(private val binaryMessenger: BinaryMessenger) { positionArg: LatLngDto, callback: (Result) -> Unit ) { - val channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerDragEvent" + val channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerDragEvent" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(viewIdArg, markerIdArg, eventTypeArg.raw, positionArg)) { if (it is List<*>) { @@ -4738,8 +4752,7 @@ class NavigationViewEventApi(private val binaryMessenger: BinaryMessenger) { } fun onPolygonClicked(viewIdArg: Long, polygonIdArg: String, callback: (Result) -> Unit) { - val channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onPolygonClicked" + val channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onPolygonClicked" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(viewIdArg, polygonIdArg)) { if (it is List<*>) { @@ -4755,8 +4768,7 @@ class NavigationViewEventApi(private val binaryMessenger: BinaryMessenger) { } fun onPolylineClicked(viewIdArg: Long, polylineIdArg: String, callback: (Result) -> Unit) { - val channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onPolylineClicked" + val channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onPolylineClicked" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(viewIdArg, polylineIdArg)) { if (it is List<*>) { @@ -4772,8 +4784,7 @@ class NavigationViewEventApi(private val binaryMessenger: BinaryMessenger) { } fun onCircleClicked(viewIdArg: Long, circleIdArg: String, callback: (Result) -> Unit) { - val channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCircleClicked" + val channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCircleClicked" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(viewIdArg, circleIdArg)) { if (it is List<*>) { @@ -4794,7 +4805,7 @@ class NavigationViewEventApi(private val binaryMessenger: BinaryMessenger) { callback: (Result) -> Unit ) { val channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onNavigationUIEnabledChanged" + "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onNavigationUIEnabledChanged" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(viewIdArg, navigationUIEnabledArg)) { if (it is List<*>) { @@ -4811,7 +4822,7 @@ class NavigationViewEventApi(private val binaryMessenger: BinaryMessenger) { fun onMyLocationClicked(viewIdArg: Long, callback: (Result) -> Unit) { val channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMyLocationClicked" + "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMyLocationClicked" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(viewIdArg)) { if (it is List<*>) { @@ -4828,7 +4839,7 @@ class NavigationViewEventApi(private val binaryMessenger: BinaryMessenger) { fun onMyLocationButtonClicked(viewIdArg: Long, callback: (Result) -> Unit) { val channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMyLocationButtonClicked" + "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMyLocationButtonClicked" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(viewIdArg)) { if (it is List<*>) { @@ -4849,8 +4860,7 @@ class NavigationViewEventApi(private val binaryMessenger: BinaryMessenger) { positionArg: CameraPositionDto, callback: (Result) -> Unit ) { - val channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCameraChanged" + val channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCameraChanged" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(viewIdArg, eventTypeArg.raw, positionArg)) { if (it is List<*>) { diff --git a/dartdoc_options.yaml b/dartdoc_options.yaml index a028247..9e49135 100644 --- a/dartdoc_options.yaml +++ b/dartdoc_options.yaml @@ -20,10 +20,13 @@ dartdoc: "Navigation View": markdown: doc/navigation-view.md name: Navigation View + "Map View": + markdown: doc/map-view.md + name: Map View "Image Registry": markdown: doc/image-registry.md name: Image Registry - categoryOrder: ["Navigation", "Navigation View", "Image Registry"] + categoryOrder: ["Navigation", "Navigation View", "Map View", "Image Registry"] showUndocumentedCategories: true nodoc: ['**/*.g.dart'] diff --git a/doc/map-view.md b/doc/map-view.md new file mode 100644 index 0000000..e69de29 diff --git a/example/integration_test/shared.dart b/example/integration_test/shared.dart index e5d242e..04800c9 100644 --- a/example/integration_test/shared.dart +++ b/example/integration_test/shared.dart @@ -33,6 +33,20 @@ export 'package:flutter_test/flutter_test.dart'; export 'package:google_navigation_flutter/google_navigation_flutter.dart'; export 'package:patrol/patrol.dart'; +// Type used for iterating over different maps to be tested. +enum TestMapType { + /// Regular google map view. + map, + + /// Navigation map. + navigation, +} + +const List testMapTypes = [ + TestMapType.map, + TestMapType.navigation +]; + /// Location coordinates for starting position simulation in Finland - Näkkäläntie. const double startLocationLat = 68.593793; const double startLocationLng = 23.510763; @@ -87,6 +101,24 @@ Widget wrapNavigationView(GoogleMapsNavigationView navigationView) { ); } +/// Pumps a [mapView] widget in tester [$] and then waits until it settles. +Future pumpMapView( + PatrolIntegrationTester $, GoogleMapsMapView mapView) async { + await $.pumpWidget(wrapMapView(mapView)); + await $.pumpAndSettle(); +} + +/// Wraps a [mapView] in widgets. +Widget wrapMapView(GoogleMapsMapView mapView) { + return MaterialApp( + home: Scaffold( + body: Center( + child: mapView, + ), + ), + ); +} + Future checkTermsAndConditionsAcceptance( PatrolIntegrationTester $) async { if (!await GoogleMapsNavigator.areTermsAccepted()) { @@ -99,8 +131,10 @@ Future checkTermsAndConditionsAcceptance( await $.pumpAndSettle(); // Tap accept or cancel. - if (Platform.isAndroid || Platform.isIOS) { + if (Platform.isAndroid) { await $.native.tap(Selector(text: "Got It")); + } else if (Platform.isIOS) { + await $.native.tap(Selector(text: "OK")); } else { fail('Unsupported platform: ${Platform.operatingSystem}'); } @@ -202,6 +236,81 @@ Future startNavigation( return controller; } +/// Returns a map view controller based on the provided test map type. +Future getMapViewControllerForTestMapType( + PatrolIntegrationTester $, { + required TestMapType testMapType, + bool initializeNavigation = true, + bool simulateLocation = false, + void Function(String)? onMarkerClicked, + void Function(String)? onCircleClicked, + void Function(LatLng)? onMapClicked, + void Function(LatLng)? onMapLongClicked, + void Function(String, LatLng)? onMarkerDrag, + void Function(String, LatLng)? onMarkerDragEnd, + void Function(String, LatLng)? onMarkerDragStart, + void Function(String)? onMarkerInfoWindowClicked, + void Function(String)? onMarkerInfoWindowClosed, + void Function(String)? onMarkerInfoWindowLongClicked, + void Function(MyLocationButtonClickedEvent)? onMyLocationButtonClicked, + void Function(MyLocationClickedEvent)? onMyLocationClicked, + void Function(bool)? onNavigationUIEnabledChanged, + void Function(String)? onPolygonClicked, + void Function(String)? onPolylineClicked, + void Function(NavigationViewRecenterButtonClickedEvent)? + onRecenterButtonClicked, + void Function(CameraPosition)? onCameraIdle, +}) async { + GoogleMapViewController viewController; + + switch (testMapType) { + /// Set up map. + case TestMapType.map: + viewController = await startMapView( + $, + onMarkerClicked: onMarkerClicked, + onCircleClicked: onCircleClicked, + onMapClicked: onMapClicked, + onMapLongClicked: onMapLongClicked, + onMarkerDrag: onMarkerDrag, + onMarkerDragEnd: onMarkerDragEnd, + onMarkerDragStart: onMarkerDragStart, + onMarkerInfoWindowClicked: onMarkerInfoWindowClicked, + onMarkerInfoWindowClosed: onMarkerInfoWindowClosed, + onMarkerInfoWindowLongClicked: onMarkerInfoWindowLongClicked, + onMyLocationButtonClicked: onMyLocationButtonClicked, + onMyLocationClicked: onMyLocationClicked, + onPolygonClicked: onPolygonClicked, + onPolylineClicked: onPolygonClicked, + ); // Instantiate a regular map. + break; + + /// Set up navigation map. + case TestMapType.navigation: + viewController = await startNavigationWithoutDestination($, + initializeNavigation: initializeNavigation, + simulateLocation: simulateLocation, + onMarkerClicked: onMarkerClicked, + onCircleClicked: onCircleClicked, + onMapClicked: onMapClicked, + onMapLongClicked: onMapLongClicked, + onMarkerDrag: onMarkerDrag, + onMarkerDragEnd: onMarkerDragEnd, + onMarkerDragStart: onMarkerDragStart, + onMarkerInfoWindowClicked: onMarkerInfoWindowClicked, + onMarkerInfoWindowClosed: onMarkerInfoWindowClosed, + onMarkerInfoWindowLongClicked: onMarkerInfoWindowLongClicked, + onMyLocationButtonClicked: onMyLocationButtonClicked, + onMyLocationClicked: onMyLocationClicked, + onPolygonClicked: onPolygonClicked, + onPolylineClicked: onPolygonClicked, + onRecenterButtonClicked: + onRecenterButtonClicked); // Instantiate a navigation map. + break; + } + return viewController; +} + /// Start navigation without setting the destination. /// /// Optionally simulate the starting location with [simulateLocation], @@ -282,6 +391,66 @@ Future startNavigationWithoutDestination( return controller; } +/// Start regular map view. +/// +/// Optionally set various event callback listener functions. +Future startMapView( + PatrolIntegrationTester $, { + void Function(String)? onMarkerClicked, + void Function(String)? onCircleClicked, + void Function(LatLng)? onMapClicked, + void Function(LatLng)? onMapLongClicked, + void Function(String, LatLng)? onMarkerDrag, + void Function(String, LatLng)? onMarkerDragEnd, + void Function(String, LatLng)? onMarkerDragStart, + void Function(String)? onMarkerInfoWindowClicked, + void Function(String)? onMarkerInfoWindowClosed, + void Function(String)? onMarkerInfoWindowLongClicked, + void Function(MyLocationButtonClickedEvent)? onMyLocationButtonClicked, + void Function(MyLocationClickedEvent)? onMyLocationClicked, + void Function(String)? onPolygonClicked, + void Function(String)? onPolylineClicked, + void Function(NavigationViewRecenterButtonClickedEvent)? + onRecenterButtonClicked, + void Function(CameraPosition)? onCameraIdle, +}) async { + final Completer controllerCompleter = + Completer(); + + //await checkLocationDialogAndTosAcceptance($); + + final Key key = GlobalKey(); + await pumpMapView( + $, + GoogleMapsMapView( + key: key, + onViewCreated: (GoogleMapViewController viewController) { + controllerCompleter.complete(viewController); + }, + onMarkerClicked: onMarkerClicked, + onCircleClicked: onCircleClicked, + onMapClicked: onMapClicked, + onMapLongClicked: onMapLongClicked, + onMarkerDrag: onMarkerDrag, + onMarkerDragEnd: onMarkerDragEnd, + onMarkerDragStart: onMarkerDragStart, + onMarkerInfoWindowClicked: onMarkerInfoWindowClicked, + onMarkerInfoWindowClosed: onMarkerInfoWindowClosed, + onMarkerInfoWindowLongClicked: onMarkerInfoWindowLongClicked, + onMyLocationButtonClicked: onMyLocationButtonClicked, + onMyLocationClicked: onMyLocationClicked, + onPolygonClicked: onPolygonClicked, + onPolylineClicked: onPolygonClicked, + onRecenterButtonClicked: onRecenterButtonClicked, + ), + ); + + final GoogleMapViewController controller = await controllerCompleter.future; + await $.pumpAndSettle(); + + return controller; +} + /// A function that waits until a certain condition is met, e.g. until the camera moves where intended. /// /// The function constantly sends the Value objects from [getValue] function diff --git a/example/integration_test/t01_initialization_test.dart b/example/integration_test/t01_initialization_test.dart index a731ebe..29a1503 100644 --- a/example/integration_test/t01_initialization_test.dart +++ b/example/integration_test/t01_initialization_test.dart @@ -265,4 +265,81 @@ void main() { expect(await controller.getMaxZoomPreference(), maxZoomPreference); expect(await controller.isNavigationUIEnabled(), true); }); + + patrol('C03 - Test Maps initialization without navigation', + (PatrolIntegrationTester $) async { + final Completer viewControllerCompleter = + Completer(); + + const CameraPosition cameraPosition = + CameraPosition(target: LatLng(latitude: 65, longitude: 25.5), zoom: 12); + const MapType mapType = MapType.satellite; + const bool compassEnabled = false; + const bool rotateGesturesEnabled = false; + const bool scrollGesturesEnabled = false; + const bool tiltGesturesEnabled = false; + const bool zoomGesturesEnabled = false; + const bool scrollGesturesEnabledDuringRotateOrZoom = false; + const bool mapToolbarEnabled = false; + const bool zoomControlsEnabled = false; + const double minZoomPreference = 5.0; + const double maxZoomPreference = 18.0; + + /// Display navigation view. + final Key key = GlobalKey(); + await pumpMapView( + $, + GoogleMapsMapView( + key: key, + onViewCreated: (GoogleMapViewController controller) { + controller.setMyLocationEnabled(true); + viewControllerCompleter.complete(controller); + }, + initialCameraPosition: cameraPosition, + initialMapType: mapType, + initialCompassEnabled: compassEnabled, + initialRotateGesturesEnabled: rotateGesturesEnabled, + initialScrollGesturesEnabled: scrollGesturesEnabled, + initialTiltGesturesEnabled: tiltGesturesEnabled, + initialZoomGesturesEnabled: zoomGesturesEnabled, + initialScrollGesturesEnabledDuringRotateOrZoom: + scrollGesturesEnabledDuringRotateOrZoom, + initialMapToolbarEnabled: mapToolbarEnabled, + initialZoomControlsEnabled: zoomControlsEnabled, + initialMinZoomPreference: minZoomPreference, + initialMaxZoomPreference: maxZoomPreference, + ), + ); + + final GoogleMapViewController controller = + await viewControllerCompleter.future; + final CameraPosition cameraOut = await controller.getCameraPosition(); + + expect(cameraOut.target.latitude, + closeTo(cameraPosition.target.latitude, 0.1)); + expect(cameraOut.target.longitude, + closeTo(cameraPosition.target.longitude, 0.1)); + expect(cameraOut.zoom, closeTo(cameraPosition.zoom, 0.1)); + expect(await controller.getMapType(), mapType); + expect(await controller.settings.isCompassEnabled(), compassEnabled); + expect(await controller.settings.isRotateGesturesEnabled(), + rotateGesturesEnabled); + expect(await controller.settings.isScrollGesturesEnabled(), + scrollGesturesEnabled); + expect( + await controller.settings.isTiltGesturesEnabled(), tiltGesturesEnabled); + expect( + await controller.settings.isZoomGesturesEnabled(), zoomGesturesEnabled); + expect( + await controller.settings.isScrollGesturesEnabledDuringRotateOrZoom(), + scrollGesturesEnabledDuringRotateOrZoom); + if (Platform.isAndroid) { + expect( + await controller.settings.isMapToolbarEnabled(), mapToolbarEnabled); + expect(await controller.settings.isZoomControlsEnabled(), + zoomControlsEnabled); + } + expect(await controller.getMinZoomPreference(), minZoomPreference); + expect(await controller.getMaxZoomPreference(), maxZoomPreference); + }); } diff --git a/example/integration_test/t02_session_test.dart b/example/integration_test/t02_session_test.dart index 9aedc79..5c0b5fc 100644 --- a/example/integration_test/t02_session_test.dart +++ b/example/integration_test/t02_session_test.dart @@ -49,9 +49,11 @@ void main() { 'test_company_name', ); - // Tap got it. - if (Platform.isAndroid || Platform.isIOS) { - await $.native.tap(Selector(text: 'Got It')); + // Tap ok. + if (Platform.isAndroid) { + await $.native.tap(Selector(text: "Got It")); + } else if (Platform.isIOS) { + await $.native.tap(Selector(text: "OK")); } else { fail('Unsupported platform: ${Platform.operatingSystem}'); } @@ -96,7 +98,13 @@ void main() { shouldOnlyShowDriverAwarenessDisclaimer: true); // Accept driver awareness disclaimer. - await $.native.tap(Selector(text: 'Got It')); + if (Platform.isAndroid) { + await $.native.tap(Selector(text: "Got It")); + } else if (Platform.isIOS) { + await $.native.tap(Selector(text: "OK")); + } else { + fail('Unsupported platform: ${Platform.operatingSystem}'); + } // Check that the results match. await tosAccepted.then((bool accept) { diff --git a/example/integration_test/t06_map_test.dart b/example/integration_test/t06_map_test.dart index 1e939bc..ebf34fa 100644 --- a/example/integration_test/t06_map_test.dart +++ b/example/integration_test/t06_map_test.dart @@ -26,281 +26,343 @@ import 'package:flutter/material.dart'; import 'shared.dart'; void main() { - patrol('Test map types', (PatrolIntegrationTester $) async { - /// Set up navigation. - final GoogleNavigationViewController viewController = - await startNavigationWithoutDestination($); - - // Test default type. - expect(await viewController.getMapType(), MapType.normal); - - final List types = [ - MapType.satellite, - MapType.terrain, - MapType.hybrid, - MapType.normal, - ]; - - for (final MapType type in types) { - await viewController.setMapType(mapType: type); - expect(await viewController.getMapType(), type); - } - }); - - patrol('Test platform view creation params', - (PatrolIntegrationTester $) async { - final Completer controllerCompleter = - Completer(); - - final Key key = GlobalKey(); - await pumpNavigationView( - $, - GoogleMapsNavigationView( - key: key, - initialMapType: MapType.hybrid, - initialCompassEnabled: false, - initialRotateGesturesEnabled: false, - initialScrollGesturesEnabled: false, - initialTiltGesturesEnabled: false, - initialZoomGesturesEnabled: false, - initialZoomControlsEnabled: false, - initialScrollGesturesEnabledDuringRotateOrZoom: false, - initialMapToolbarEnabled: false, - onViewCreated: (GoogleNavigationViewController viewController) { - controllerCompleter.complete(viewController); - }, - ), - ); - - final GoogleNavigationViewController controller = - await controllerCompleter.future; - - /// Test the value initialization succeeded - expect(await controller.getMapType(), MapType.hybrid); - expect(await controller.settings.isCompassEnabled(), false); - expect(await controller.settings.isRotateGesturesEnabled(), false); - expect(await controller.settings.isScrollGesturesEnabled(), false); - expect(await controller.settings.isTiltGesturesEnabled(), false); - expect(await controller.settings.isZoomGesturesEnabled(), false); - expect( - await controller.settings.isScrollGesturesEnabledDuringRotateOrZoom(), - false); - - if (Platform.isAndroid) { - expect(await controller.settings.isZoomControlsEnabled(), false); - expect(await controller.settings.isMapToolbarEnabled(), false); - } - }); - - patrol('Test map UI settings', (PatrolIntegrationTester $) async { - /// The events are not tested because there's currently no reliable way to trigger them. - void onMyLocationButtonClicked(MyLocationButtonClickedEvent event) { - debugPrint('My location button clicked event: currently $event'); - } - - /// The events are not tested because there's no reliable way to trigger them currently. - void onMyLocationClicked(MyLocationClickedEvent event) { - debugPrint('My location clicked event: currently $event'); - } - - /// The events are not tested because there's no reliable way to trigger them currently. - void onMapLongClicked(LatLng coordinates) { - debugPrint( - 'Map clicked event lat: ${coordinates.latitude}, lng: ${coordinates.longitude}.'); - } - - /// Set up navigation without initialization to test isMyLocationEnabled - /// is false before initialization is done. Test the onMapClicked event - /// and setting the other callback functions. - final GoogleNavigationViewController controller = - await startNavigationWithoutDestination( - $, - initializeNavigation: false, - onMapClicked: expectAsync1((LatLng msg) { - expectSync(msg, isA()); - }, max: 1), - onMapLongClicked: onMapLongClicked, - onMyLocationButtonClicked: onMyLocationButtonClicked, - onMyLocationClicked: onMyLocationClicked, - ); - - /// Test that the onMapClicked event comes in. - await $.native.tapAt(const Offset(0.5, 0.5)); - - /// Test the default values match with what has been documented in the - /// API documentation in google_navigation_flutter.dart file. - expect(await controller.isMyLocationEnabled(), false); - expect(await controller.settings.isMyLocationButtonEnabled(), true); - expect(await controller.settings.isZoomGesturesEnabled(), true); - expect(await controller.settings.isCompassEnabled(), true); - expect(await controller.settings.isRotateGesturesEnabled(), true); - expect(await controller.settings.isScrollGesturesEnabled(), true); - expect( - await controller.settings.isScrollGesturesEnabledDuringRotateOrZoom(), - true); - expect(await controller.settings.isTiltGesturesEnabled(), true); - if (Platform.isAndroid) { - expect(await controller.settings.isMapToolbarEnabled(), true); - } - - final List results = [true, false, true]; - for (final bool result in results) { - await controller.setMyLocationEnabled(result); - expect(await controller.isMyLocationEnabled(), result); - - await controller.settings.setMyLocationButtonEnabled(result); - expect(await controller.settings.isMyLocationButtonEnabled(), result); - - await controller.settings.setZoomGesturesEnabled(result); - expect(await controller.settings.isZoomGesturesEnabled(), result); - - await controller.settings.setCompassEnabled(result); - expect(await controller.settings.isCompassEnabled(), result); - - await controller.settings.setRotateGesturesEnabled(result); - expect(await controller.settings.isRotateGesturesEnabled(), result); - - await controller.settings.setScrollGesturesEnabled(result); - expect(await controller.settings.isScrollGesturesEnabled(), result); - - await controller.settings - .setScrollGesturesDuringRotateOrZoomEnabled(result); + for (final TestMapType testMapType in testMapTypes) { + patrol('Test map types (${testMapType.name})', + (PatrolIntegrationTester $) async { + /// Get viewController for the test type (navigation map or regular map). + GoogleMapViewController viewController = + await getMapViewControllerForTestMapType($, testMapType: testMapType); + + // Test default type. + expect(await viewController.getMapType(), MapType.normal); + + final List types = [ + MapType.satellite, + MapType.terrain, + MapType.hybrid, + MapType.normal, + ]; + + for (final MapType type in types) { + await viewController.setMapType(mapType: type); + expect(await viewController.getMapType(), type); + } + }); + } + + for (final TestMapType testMapType in testMapTypes) { + patrol('Test platform view creation params (${testMapType.name})', + (PatrolIntegrationTester $) async { + final Completer controllerCompleter = + Completer(); + + switch (testMapType) { + case TestMapType.map: + final Key key = GlobalKey(); + await pumpMapView( + $, + GoogleMapsMapView( + key: key, + initialMapType: MapType.hybrid, + initialCompassEnabled: false, + initialRotateGesturesEnabled: false, + initialScrollGesturesEnabled: false, + initialTiltGesturesEnabled: false, + initialZoomGesturesEnabled: false, + initialZoomControlsEnabled: false, + initialScrollGesturesEnabledDuringRotateOrZoom: false, + initialMapToolbarEnabled: false, + onViewCreated: (GoogleMapViewController viewController) { + controllerCompleter.complete(viewController); + }, + ), + ); + break; + case TestMapType.navigation: + final Key key = GlobalKey(); + await pumpNavigationView( + $, + GoogleMapsNavigationView( + key: key, + initialMapType: MapType.hybrid, + initialCompassEnabled: false, + initialRotateGesturesEnabled: false, + initialScrollGesturesEnabled: false, + initialTiltGesturesEnabled: false, + initialZoomGesturesEnabled: false, + initialZoomControlsEnabled: false, + initialScrollGesturesEnabledDuringRotateOrZoom: false, + initialMapToolbarEnabled: false, + onViewCreated: (GoogleNavigationViewController viewController) { + controllerCompleter.complete(viewController); + }, + ), + ); + break; + } + + final GoogleMapViewController controller = + await controllerCompleter.future; + + /// Test the value initialization succeeded + expect(await controller.getMapType(), MapType.hybrid); + expect(await controller.settings.isCompassEnabled(), false); + expect(await controller.settings.isRotateGesturesEnabled(), false); + expect(await controller.settings.isScrollGesturesEnabled(), false); + expect(await controller.settings.isTiltGesturesEnabled(), false); + expect(await controller.settings.isZoomGesturesEnabled(), false); expect( await controller.settings.isScrollGesturesEnabledDuringRotateOrZoom(), - result); + false); + + if (Platform.isAndroid) { + expect(await controller.settings.isZoomControlsEnabled(), false); + expect(await controller.settings.isMapToolbarEnabled(), false); + } + }); + } + + for (final TestMapType testMapType in testMapTypes) { + patrol('Test map UI settings (${testMapType.name})', + (PatrolIntegrationTester $) async { + /// The events are not tested because there's currently no reliable way to trigger them. + void onMyLocationButtonClicked(MyLocationButtonClickedEvent event) { + debugPrint('My location button clicked event: currently $event'); + } - await controller.settings.setTiltGesturesEnabled(result); - expect(await controller.settings.isTiltGesturesEnabled(), result); + /// The events are not tested because there's no reliable way to trigger them currently. + void onMyLocationClicked(MyLocationClickedEvent event) { + debugPrint('My location clicked event: currently $event'); + } - await controller.settings.setTrafficEnabled(result); - expect(await controller.settings.isTrafficEnabled(), result); + /// The events are not tested because there's no reliable way to trigger them currently. + void onMapLongClicked(LatLng coordinates) { + debugPrint( + 'Map clicked event lat: ${coordinates.latitude}, lng: ${coordinates.longitude}.'); + } + /// Set up navigation without initialization to test isMyLocationEnabled + /// is false before initialization is done. Test the onMapClicked event + /// and setting the other callback functions. + final GoogleMapViewController controller = + + /// Get viewController for the test type (navigation map or regular map). + await getMapViewControllerForTestMapType( + $, + testMapType: testMapType, + initializeNavigation: false, + onMapClicked: expectAsync1((LatLng msg) { + expectSync(msg, isA()); + }, max: 1), + onMapLongClicked: onMapLongClicked, + onMyLocationButtonClicked: onMyLocationButtonClicked, + onMyLocationClicked: onMyLocationClicked, + ); + + /// Test that the onMapClicked event comes in. + await $.native.tapAt(const Offset(0.5, 0.5)); + + /// Test the default values match with what has been documented in the + /// API documentation in google_navigation_flutter.dart file. + expect(await controller.isMyLocationEnabled(), false); + expect(await controller.settings.isMyLocationButtonEnabled(), true); + expect(await controller.settings.isZoomGesturesEnabled(), true); + expect(await controller.settings.isCompassEnabled(), true); + expect(await controller.settings.isRotateGesturesEnabled(), true); + expect(await controller.settings.isScrollGesturesEnabled(), true); + expect( + await controller.settings.isScrollGesturesEnabledDuringRotateOrZoom(), + true); + expect(await controller.settings.isTiltGesturesEnabled(), true); if (Platform.isAndroid) { - await controller.settings.setZoomControlsEnabled(result); - expect(await controller.settings.isZoomControlsEnabled(), result); + expect(await controller.settings.isMapToolbarEnabled(), true); + } + + final List results = [true, false, true]; + for (final bool result in results) { + await controller.setMyLocationEnabled(result); + expect(await controller.isMyLocationEnabled(), result); + + await controller.settings.setMyLocationButtonEnabled(result); + expect(await controller.settings.isMyLocationButtonEnabled(), result); + + await controller.settings.setZoomGesturesEnabled(result); + expect(await controller.settings.isZoomGesturesEnabled(), result); + + await controller.settings.setCompassEnabled(result); + expect(await controller.settings.isCompassEnabled(), result); + + await controller.settings.setRotateGesturesEnabled(result); + expect(await controller.settings.isRotateGesturesEnabled(), result); + + await controller.settings.setScrollGesturesEnabled(result); + expect(await controller.settings.isScrollGesturesEnabled(), result); + + await controller.settings + .setScrollGesturesDuringRotateOrZoomEnabled(result); + expect( + await controller.settings + .isScrollGesturesEnabledDuringRotateOrZoom(), + result); - await controller.settings.setMapToolbarEnabled(result); - expect(await controller.settings.isMapToolbarEnabled(), result); + await controller.settings.setTiltGesturesEnabled(result); + expect(await controller.settings.isTiltGesturesEnabled(), result); + + await controller.settings.setTrafficEnabled(result); + expect(await controller.settings.isTrafficEnabled(), result); + + if (Platform.isAndroid) { + await controller.settings.setZoomControlsEnabled(result); + expect(await controller.settings.isZoomControlsEnabled(), result); + + await controller.settings.setMapToolbarEnabled(result); + expect(await controller.settings.isMapToolbarEnabled(), result); + } } - } - // Test methods not supported on iOS - if (Platform.isIOS) { - try { - await controller.settings.isZoomControlsEnabled(); - fail('Expected to get UnsupportedError'); - } on Object catch (e) { - expect(e, const TypeMatcher()); + // Test methods not supported on iOS + if (Platform.isIOS) { + try { + await controller.settings.isZoomControlsEnabled(); + fail('Expected to get UnsupportedError'); + } on Object catch (e) { + expect(e, const TypeMatcher()); + } + try { + await controller.settings.setZoomControlsEnabled(true); + fail('Expected to get UnsupportedError'); + } on Object catch (e) { + expect(e, const TypeMatcher()); + } + try { + await controller.settings.isMapToolbarEnabled(); + fail('Expected to get UnsupportedError'); + } on Object catch (e) { + expect(e, const TypeMatcher()); + } + try { + await controller.settings.setMapToolbarEnabled(true); + fail('Expected to get UnsupportedError'); + } on Object catch (e) { + expect(e, const TypeMatcher()); + } } + }); + } + + for (final TestMapType testMapType in testMapTypes) { + patrol('Test map style (${testMapType.name})', + (PatrolIntegrationTester $) async { + /// Get viewController for the test type (navigation map or regular map). + GoogleMapViewController viewController = + await getMapViewControllerForTestMapType($, testMapType: testMapType); + + // Test that valid json doens't throw exception. + await viewController.setMapStyle( + '[{"elementType":"geometry","stylers":[{"color":"#ffffff"}]}]'); + + // Test that null value doesn't throw exception. + await viewController.setMapStyle(null); + + // Test that invalid json throws exception. try { - await controller.settings.setZoomControlsEnabled(true); - fail('Expected to get UnsupportedError'); - } on Object catch (e) { - expect(e, const TypeMatcher()); + await viewController.setMapStyle('not_json'); + fail('expected to get MapStyleException'); + } on MapStyleException catch (e) { + expect(e, isNotNull); } + }); + } + + for (final TestMapType testMapType in testMapTypes) { + patrol('Test min max zoom level (${testMapType.name})', + (PatrolIntegrationTester $) async { + /// For some reason the functionality works on Android example app, but it doesn't work + /// during the testing. Will skip Android testing for now. + final Completer viewControllerCompleter = + Completer(); + + await checkLocationDialogAcceptance($); + + switch (testMapType) { + case TestMapType.map: + + /// Display map view. + final Key key = GlobalKey(); + await pumpMapView( + $, + GoogleMapsMapView( + key: key, + onViewCreated: (GoogleMapViewController controller) { + viewControllerCompleter.complete(controller); + }, + ), + ); + break; + case TestMapType.navigation: + + /// Display navigation view. + final Key key = GlobalKey(); + await pumpNavigationView( + $, + GoogleMapsNavigationView( + key: key, + onViewCreated: (GoogleNavigationViewController controller) { + viewControllerCompleter.complete(controller); + }, + ), + ); + break; + } + + final GoogleMapViewController viewController = + await viewControllerCompleter.future; + + // Test that valid zoom values don't throw exception. + await viewController.setMinZoomPreference(10); + await viewController.setMaxZoomPreference(11); + + // Test that min max values were changed. + double newMinZoomPreference = await viewController.getMinZoomPreference(); + double newMaxZoomPreference = await viewController.getMaxZoomPreference(); + + expect(newMinZoomPreference, 10.0); + expect(newMaxZoomPreference, 11.0); + + // Reset zoom limits. + await viewController.resetMinMaxZoomPreference(); + + // Test that min max values were reset. + final double resetedMinZoom = await viewController.getMinZoomPreference(); + final double resetedMaxZoom = await viewController.getMaxZoomPreference(); + + expect(resetedMinZoom, isNot(10.0)); + expect(resetedMaxZoom, isNot(11.0)); + + // Test that invalid value throws exception. try { - await controller.settings.isMapToolbarEnabled(); - fail('Expected to get UnsupportedError'); - } on Object catch (e) { - expect(e, const TypeMatcher()); + await viewController.setMinZoomPreference(40); + fail('expected to get ZoomPreferenceException'); + } on MinZoomRangeException catch (e) { + expect(e, isNotNull); } try { - await controller.settings.setMapToolbarEnabled(true); - fail('Expected to get UnsupportedError'); - } on Object catch (e) { - expect(e, const TypeMatcher()); + await viewController.setMaxZoomPreference(1); + fail('expected to get ZoomPreferenceException'); + } on MaxZoomRangeException catch (e) { + expect(e, isNotNull); } - } - }); - - patrol('Test map style', (PatrolIntegrationTester $) async { - /// Set up navigation. - final GoogleNavigationViewController viewController = - await startNavigationWithoutDestination($); - - // Test that valid json doens't throw exception. - await viewController.setMapStyle( - '[{"elementType":"geometry","stylers":[{"color":"#ffffff"}]}]'); - - // Test that null value doesn't throw exception. - await viewController.setMapStyle(null); - - // Test that invalid json throws exception. - try { - await viewController.setMapStyle('not_json'); - fail('expected to get MapStyleException'); - } on MapStyleException catch (e) { - expect(e, isNotNull); - } - }); - - patrol('Test min max zoom level', (PatrolIntegrationTester $) async { - /// For some reason the functionality works on Android example app, but it doesn't work - /// during the testing. Will skip Android testing for now. - final Completer viewControllerCompleter = - Completer(); - - await checkLocationDialogAcceptance($); - - /// Display navigation view. - final Key key = GlobalKey(); - await pumpNavigationView( - $, - GoogleMapsNavigationView( - key: key, - onViewCreated: (GoogleNavigationViewController controller) { - viewControllerCompleter.complete(controller); - }, - ), - ); - - final GoogleNavigationViewController viewController = - await viewControllerCompleter.future; - - // Test that valid zoom values don't throw exception. - await viewController.setMinZoomPreference(10); - await viewController.setMaxZoomPreference(11); - - // Test that min max values were changed. - double newMinZoomPreference = await viewController.getMinZoomPreference(); - double newMaxZoomPreference = await viewController.getMaxZoomPreference(); - - expect(newMinZoomPreference, 10.0); - expect(newMaxZoomPreference, 11.0); - - // Reset zoom limits. - await viewController.resetMinMaxZoomPreference(); - - // Test that min max values were reset. - final double resetedMinZoom = await viewController.getMinZoomPreference(); - final double resetedMaxZoom = await viewController.getMaxZoomPreference(); - - expect(resetedMinZoom, isNot(10.0)); - expect(resetedMaxZoom, isNot(11.0)); - - // Test that invalid value throws exception. - try { - await viewController.setMinZoomPreference(40); - fail('expected to get ZoomPreferenceException'); - } on MinZoomRangeException catch (e) { - expect(e, isNotNull); - } - try { - await viewController.setMaxZoomPreference(1); - fail('expected to get ZoomPreferenceException'); - } on MaxZoomRangeException catch (e) { - expect(e, isNotNull); - } - - // Try to set out of bounds values. - await viewController.setMinZoomPreference(0); - await viewController.setMaxZoomPreference(50); - - newMinZoomPreference = await viewController.getMinZoomPreference(); - newMaxZoomPreference = await viewController.getMaxZoomPreference(); - - // Expect the same values. The actual zoom level will be limited by the map. - expect(newMinZoomPreference, 0.0); - expect(newMaxZoomPreference, 50.0); - }); + + // Try to set out of bounds values. + await viewController.setMinZoomPreference(0); + await viewController.setMaxZoomPreference(50); + + newMinZoomPreference = await viewController.getMinZoomPreference(); + newMaxZoomPreference = await viewController.getMaxZoomPreference(); + + // Expect the same values. The actual zoom level will be limited by the map. + expect(newMinZoomPreference, 0.0); + expect(newMaxZoomPreference, 50.0); + }); + } } diff --git a/example/integration_test/t08_marker_polygon_polyline_circle_test.dart b/example/integration_test/t08_marker_polygon_polyline_circle_test.dart index 065c4df..9cd7a28 100644 --- a/example/integration_test/t08_marker_polygon_polyline_circle_test.dart +++ b/example/integration_test/t08_marker_polygon_polyline_circle_test.dart @@ -28,944 +28,973 @@ import 'package:flutter/services.dart' show rootBundle; import 'shared.dart'; void main() { - patrol('Marker tests', (PatrolIntegrationTester $) async { - void onMarkerClicked(String event) { - debugPrint('Marker clicked event: $event.'); - } - - /// The events are not tested because there's currently no reliable way to trigger them. - void onMarkerDrag(String event, LatLng coordinates) { - debugPrint('Marker dragged event: $event. Coorinates: $coordinates.'); - } - - /// The events are not tested because there's currently no reliable way to trigger them. - void onMarkerInfoWindowAction(String event) { - debugPrint('Marker dragged event: $event.'); - } - - /// Set up navigation and test setting the callback functions. - final GoogleNavigationViewController viewController = - await startNavigationWithoutDestination( - $, - onMarkerClicked: onMarkerClicked, - onMarkerDrag: onMarkerDrag, - onMarkerDragEnd: onMarkerDrag, - onMarkerDragStart: onMarkerDrag, - onMarkerInfoWindowClicked: onMarkerInfoWindowAction, - onMarkerInfoWindowClosed: onMarkerInfoWindowAction, - onMarkerInfoWindowLongClicked: onMarkerInfoWindowAction, - ); - - // markerOne options. - const MarkerOptions markerOneOptions = MarkerOptions( - position: - LatLng(latitude: 60.34856639667419, longitude: 25.03459821831162), - infoWindow: InfoWindow( - title: 'Helsinki Office', - snippet: 'markerOne', - ), - ); - - // Add marker and save response to [addedMarkersList]. - final List addedMarkersList = - await viewController.addMarkers([markerOneOptions]); - expect(addedMarkersList.length, 1); - final Marker? addedMarker = addedMarkersList.first; - - // Get markers and save them to [getMarkerList]. - final List getMarkersList = await viewController.getMarkers(); - expect(getMarkersList.length, 1); - final Marker? getMarker = getMarkersList.first; - - List markers = [addedMarker!, getMarker!]; - - /// Test MarkerOptions default values against addedMarker and getMarkers responses. - for (final Marker marker in markers) { - expect(marker.markerId, 'Marker_0'); - expect(marker.options.alpha, 1.0); - expect(marker.options.anchor.u, 0.5); - expect(marker.options.anchor.v, 1.0); - expect(marker.options.draggable, false); - expect(marker.options.flat, false); - expect(marker.options.icon, ImageDescriptor.defaultImage); - expect(marker.options.consumeTapEvents, false); - expect(marker.options.position, markerOneOptions.position); - expect(marker.options.rotation, 0.0); - expect( - marker.options.infoWindow.title, markerOneOptions.infoWindow.title); - expect(marker.options.infoWindow.snippet, - markerOneOptions.infoWindow.snippet); - expect(marker.options.infoWindow.anchor.u, 0.5); - expect(marker.options.infoWindow.anchor.v, 0.0); - expect(marker.options.visible, true); - expect(marker.options.zIndex, 0.0); - } - - /// Create a marker icon. - final ByteData imageBytes = await rootBundle.load('assets/marker1.png'); - final ImageDescriptor customIcon = - await registerBitmapImage(bitmap: imageBytes, imagePixelRatio: 2); - - // markerTwo options. - final MarkerOptions markerTwoOptions = MarkerOptions( - alpha: 0.5, - anchor: const MarkerAnchor(u: 0.1, v: 0.2), - draggable: true, - flat: true, - icon: customIcon, - consumeTapEvents: true, - position: const LatLng( - latitude: 65.01193816057041, longitude: 25.46790635614996), - rotation: 70, - infoWindow: const InfoWindow( - title: 'Oulu Office', - snippet: 'markerTwo', - anchor: MarkerAnchor(u: 0.3, v: 0.4), - ), - visible: false, - zIndex: 2, - ); - - final Marker markerTwo = addedMarker.copyWith(options: markerTwoOptions); - - // Update marker and save response. - final List updatedMarkersList = - await viewController.updateMarkers([markerTwo]); - expect(updatedMarkersList.length, 1); - final Marker? updatedMarker = updatedMarkersList.first; - - // Get updated markers and save them to [getUpdatedMarkerList]. - final List getUpdatedMarkersList = - await viewController.getMarkers(); - expect(getUpdatedMarkersList.length, 1); - final Marker? getUpdatedMarker = getUpdatedMarkersList.first; - - const double tolerance = 0.0000001; - markers = [updatedMarker!, getUpdatedMarker!]; - - /// Test updated marker options against updateMarkers and getMarkers responses. - for (final Marker marker in markers) { - expect(marker.markerId, addedMarker.markerId); - expect(marker.options.alpha, markerTwoOptions.alpha); - expect(marker.options.anchor.u, - closeTo(markerTwoOptions.anchor.u, tolerance)); - expect(marker.options.anchor.v, - closeTo(markerTwoOptions.anchor.v, tolerance)); - expect(marker.options.draggable, markerTwoOptions.draggable); - expect(marker.options.flat, markerTwoOptions.flat); - expect(marker.options.icon, markerTwoOptions.icon); + for (final TestMapType testMapType in testMapTypes) { + patrol('Marker tests (${testMapType.name})', + (PatrolIntegrationTester $) async { + void onMarkerClicked(String event) { + debugPrint('Marker clicked event: $event.'); + } + + /// The events are not tested because there's currently no reliable way to trigger them. + void onMarkerDrag(String event, LatLng coordinates) { + debugPrint('Marker dragged event: $event. Coorinates: $coordinates.'); + } + + /// The events are not tested because there's currently no reliable way to trigger them. + void onMarkerInfoWindowAction(String event) { + debugPrint('Marker dragged event: $event.'); + } + + /// Get viewController for the test type (navigation map or regular map). + final GoogleMapViewController viewController = + await getMapViewControllerForTestMapType( + $, + testMapType: testMapType, + onMarkerClicked: onMarkerClicked, + onMarkerDrag: onMarkerDrag, + onMarkerDragEnd: onMarkerDrag, + onMarkerDragStart: onMarkerDrag, + onMarkerInfoWindowClicked: onMarkerInfoWindowAction, + onMarkerInfoWindowClosed: onMarkerInfoWindowAction, + onMarkerInfoWindowLongClicked: onMarkerInfoWindowAction, + ); + + // markerOne options. + const MarkerOptions markerOneOptions = MarkerOptions( + position: + LatLng(latitude: 60.34856639667419, longitude: 25.03459821831162), + infoWindow: InfoWindow( + title: 'Helsinki Office', + snippet: 'markerOne', + ), + ); + + // Add marker and save response to [addedMarkersList]. + final List addedMarkersList = + await viewController.addMarkers([markerOneOptions]); + expect(addedMarkersList.length, 1); + final Marker? addedMarker = addedMarkersList.first; + + // Get markers and save them to [getMarkerList]. + final List getMarkersList = await viewController.getMarkers(); + expect(getMarkersList.length, 1); + final Marker? getMarker = getMarkersList.first; + + List markers = [addedMarker!, getMarker!]; + + /// Test MarkerOptions default values against addedMarker and getMarkers responses. + for (final Marker marker in markers) { + expect(marker.options.alpha, 1.0); + expect(marker.options.anchor.u, 0.5); + expect(marker.options.anchor.v, 1.0); + expect(marker.options.draggable, false); + expect(marker.options.flat, false); + expect(marker.options.icon, ImageDescriptor.defaultImage); + expect(marker.options.consumeTapEvents, false); + expect(marker.options.position, markerOneOptions.position); + expect(marker.options.rotation, 0.0); + expect( + marker.options.infoWindow.title, markerOneOptions.infoWindow.title); + expect(marker.options.infoWindow.snippet, + markerOneOptions.infoWindow.snippet); + expect(marker.options.infoWindow.anchor.u, 0.5); + expect(marker.options.infoWindow.anchor.v, 0.0); + expect(marker.options.visible, true); + expect(marker.options.zIndex, 0.0); + } + + /// Create a marker icon. + final ByteData imageBytes = await rootBundle.load('assets/marker1.png'); + final ImageDescriptor customIcon = + await registerBitmapImage(bitmap: imageBytes, imagePixelRatio: 2); + + // markerTwo options. + final MarkerOptions markerTwoOptions = MarkerOptions( + alpha: 0.5, + anchor: const MarkerAnchor(u: 0.1, v: 0.2), + draggable: true, + flat: true, + icon: customIcon, + consumeTapEvents: true, + position: const LatLng( + latitude: 65.01193816057041, longitude: 25.46790635614996), + rotation: 70, + infoWindow: const InfoWindow( + title: 'Oulu Office', + snippet: 'markerTwo', + anchor: MarkerAnchor(u: 0.3, v: 0.4), + ), + visible: false, + zIndex: 2, + ); + + final Marker markerTwo = addedMarker.copyWith(options: markerTwoOptions); + + // Update marker and save response. + final List updatedMarkersList = + await viewController.updateMarkers([markerTwo]); + expect(updatedMarkersList.length, 1); + final Marker? updatedMarker = updatedMarkersList.first; + + // Get updated markers and save them to [getUpdatedMarkerList]. + final List getUpdatedMarkersList = + await viewController.getMarkers(); + expect(getUpdatedMarkersList.length, 1); + final Marker? getUpdatedMarker = getUpdatedMarkersList.first; + + const double tolerance = 0.0000001; + markers = [updatedMarker!, getUpdatedMarker!]; + + /// Test updated marker options against updateMarkers and getMarkers responses. + for (final Marker marker in markers) { + expect(marker.markerId, addedMarker.markerId); + expect(marker.options.alpha, markerTwoOptions.alpha); + expect(marker.options.anchor.u, + closeTo(markerTwoOptions.anchor.u, tolerance)); + expect(marker.options.anchor.v, + closeTo(markerTwoOptions.anchor.v, tolerance)); + expect(marker.options.draggable, markerTwoOptions.draggable); + expect(marker.options.flat, markerTwoOptions.flat); + expect(marker.options.icon, markerTwoOptions.icon); + expect( + marker.options.consumeTapEvents, markerTwoOptions.consumeTapEvents); + expect(marker.options.infoWindow.anchor.u, + closeTo(markerTwoOptions.infoWindow.anchor.u, tolerance)); + expect(marker.options.infoWindow.anchor.v, + closeTo(markerTwoOptions.infoWindow.anchor.v, tolerance)); + expect(marker.options.position, markerTwoOptions.position); + expect(marker.options.rotation, markerTwoOptions.rotation); + expect(marker.options.infoWindow.snippet, + markerTwoOptions.infoWindow.snippet); + expect( + marker.options.infoWindow.title, markerTwoOptions.infoWindow.title); + expect(marker.options.visible, markerTwoOptions.visible); + expect(marker.options.zIndex, markerTwoOptions.zIndex); + } + + // markerThree options. + const MarkerOptions markerThreeOptions = MarkerOptions( + position: + LatLng(latitude: 62.25743381335948, longitude: 25.779330148583174), + infoWindow: InfoWindow( + title: 'Jyväskylä', + snippet: 'markerThree', + ), + ); + + /// Test addMarkers() adds markers in correct order. + final List removeMarkerList = + await viewController.addMarkers([ + markerThreeOptions, + markerOneOptions, + ]); + + final List getRemoveMarkerList = + await viewController.getMarkers(); + + expect(removeMarkerList.length, 2); + expect(removeMarkerList.first!.options.infoWindow.title, 'Jyväskylä'); expect( - marker.options.consumeTapEvents, markerTwoOptions.consumeTapEvents); - expect(marker.options.infoWindow.anchor.u, - closeTo(markerTwoOptions.infoWindow.anchor.u, tolerance)); - expect(marker.options.infoWindow.anchor.v, - closeTo(markerTwoOptions.infoWindow.anchor.v, tolerance)); - expect(marker.options.position, markerTwoOptions.position); - expect(marker.options.rotation, markerTwoOptions.rotation); - expect(marker.options.infoWindow.snippet, - markerTwoOptions.infoWindow.snippet); + removeMarkerList.last!.options.infoWindow.title, 'Helsinki Office'); + expect(getRemoveMarkerList.length, 3); expect( - marker.options.infoWindow.title, markerTwoOptions.infoWindow.title); - expect(marker.options.visible, markerTwoOptions.visible); - expect(marker.options.zIndex, markerTwoOptions.zIndex); - } - - // markerThree options. - const MarkerOptions markerThreeOptions = MarkerOptions( - position: - LatLng(latitude: 62.25743381335948, longitude: 25.779330148583174), - infoWindow: InfoWindow( - title: 'Jyväskylä', - snippet: 'markerThree', - ), - ); - - /// Test addMarkers() adds markers in correct order. - final List removeMarkerList = - await viewController.addMarkers([ - markerThreeOptions, - markerOneOptions, - ]); - - final List getRemoveMarkerList = await viewController.getMarkers(); - - expect(removeMarkerList.length, 2); - expect(removeMarkerList.first!.options.infoWindow.title, 'Jyväskylä'); - expect(removeMarkerList.last!.options.infoWindow.title, 'Helsinki Office'); - expect(getRemoveMarkerList.length, 3); - expect(getRemoveMarkerList.first!.options.infoWindow.title, 'Oulu Office'); - expect( - getRemoveMarkerList.last!.options.infoWindow.title, 'Helsinki Office'); - - /// Test removeMarkers() removes correct markers. - // Remove the first marker = ouluOffice marker. - final Marker firstMarker = getRemoveMarkerList.first!; - await viewController.removeMarkers([firstMarker]); - List getRemovedMarkerList = await viewController.getMarkers(); - expect(getRemovedMarkerList.length, 2); - expect(getRemovedMarkerList.first!.options.infoWindow.title, 'Jyväskylä'); - expect( - getRemovedMarkerList.last!.options.infoWindow.title, 'Helsinki Office'); - - /// Test that trying to remove or update a marker that doesn't exist - /// throws error. - try { + getRemoveMarkerList.first!.options.infoWindow.title, 'Oulu Office'); + expect(getRemoveMarkerList.last!.options.infoWindow.title, + 'Helsinki Office'); + + /// Test removeMarkers() removes correct markers. + // Remove the first marker = ouluOffice marker. + final Marker firstMarker = getRemoveMarkerList.first!; await viewController.removeMarkers([firstMarker]); - fail('Expected removeMarkers() to fail with MarkerNotFoundException.'); - } on MarkerNotFoundException catch (e) { - expect(e, isNotNull); - } - try { - await viewController.updateMarkers([firstMarker]); - fail('Expected updateMarkers() to fail with MarkerNotFoundException.'); - } on MarkerNotFoundException catch (e) { - expect(e, isNotNull); - } - - // Remove Helsinki office marker. - await viewController.removeMarkers([removeMarkerList.last!]); - getRemovedMarkerList = await viewController.getMarkers(); - expect(getRemovedMarkerList.length, 1); - expect(getRemovedMarkerList.first!.options.infoWindow.title, 'Jyväskylä'); - - // Add two markers. - List clearMarkerList = await viewController - .addMarkers([markerOneOptions, markerTwoOptions]); - List getClearMarkerList = await viewController.getMarkers(); - - expect(clearMarkerList.length, 2); - expect(clearMarkerList.first!.options.infoWindow.title, 'Helsinki Office'); - expect(clearMarkerList.last!.options.infoWindow.title, 'Oulu Office'); - expect(getClearMarkerList.length, 3); - expect(getClearMarkerList.first!.options.infoWindow.title, 'Jyväskylä'); - expect(getClearMarkerList.last!.options.infoWindow.title, 'Oulu Office'); - - /// Remove the middle marker and test the order stays. - await viewController.removeMarkers([getClearMarkerList[1]!]); - - getClearMarkerList = await viewController.getMarkers(); - expect(getClearMarkerList.length, 2); - expect(getClearMarkerList.first!.options.infoWindow.title, 'Jyväskylä'); - expect(getClearMarkerList.last!.options.infoWindow.title, 'Oulu Office'); - - /// Test clearMarkers() function works. - await viewController.clearMarkers(); - - getClearMarkerList = await viewController.getMarkers(); - expect(getClearMarkerList, isEmpty); - - /// Test clear() function clears also markers. - clearMarkerList = await viewController - .addMarkers([markerOneOptions, markerTwoOptions]); - getClearMarkerList = await viewController.getMarkers(); - expect(clearMarkerList.length, 2); - expect(getClearMarkerList.length, 2); - - await viewController.clear(); - getClearMarkerList = await viewController.getMarkers(); - expect(getClearMarkerList, isEmpty); - }); - - patrol('Test polylines', (PatrolIntegrationTester $) async { - /// The events are not tested because there's currently no reliable way to trigger them. - void onPolylineClicked(String event) { - debugPrint('Polyline clicked event: $event.'); - } - - /// Set up navigation and test setting the callback function. - final GoogleNavigationViewController viewController = - await startNavigationWithoutDestination($, - onPolylineClicked: onPolylineClicked); - - await viewController.addPolylines( - [ - const PolylineOptions( + List getRemovedMarkerList = await viewController.getMarkers(); + expect(getRemovedMarkerList.length, 2); + expect(getRemovedMarkerList.first!.options.infoWindow.title, 'Jyväskylä'); + expect(getRemovedMarkerList.last!.options.infoWindow.title, + 'Helsinki Office'); + + /// Test that trying to remove or update a marker that doesn't exist + /// throws error. + try { + await viewController.removeMarkers([firstMarker]); + fail('Expected removeMarkers() to fail with MarkerNotFoundException.'); + } on MarkerNotFoundException catch (e) { + expect(e, isNotNull); + } + try { + await viewController.updateMarkers([firstMarker]); + fail('Expected updateMarkers() to fail with MarkerNotFoundException.'); + } on MarkerNotFoundException catch (e) { + expect(e, isNotNull); + } + + // Remove Helsinki office marker. + await viewController.removeMarkers([removeMarkerList.last!]); + getRemovedMarkerList = await viewController.getMarkers(); + expect(getRemovedMarkerList.length, 1); + expect(getRemovedMarkerList.first!.options.infoWindow.title, 'Jyväskylä'); + + // Add two markers. + List clearMarkerList = await viewController + .addMarkers([markerOneOptions, markerTwoOptions]); + List getClearMarkerList = await viewController.getMarkers(); + + expect(clearMarkerList.length, 2); + expect( + clearMarkerList.first!.options.infoWindow.title, 'Helsinki Office'); + expect(clearMarkerList.last!.options.infoWindow.title, 'Oulu Office'); + expect(getClearMarkerList.length, 3); + expect(getClearMarkerList.first!.options.infoWindow.title, 'Jyväskylä'); + expect(getClearMarkerList.last!.options.infoWindow.title, 'Oulu Office'); + + /// Remove the middle marker and test the order stays. + await viewController.removeMarkers([getClearMarkerList[1]!]); + + getClearMarkerList = await viewController.getMarkers(); + expect(getClearMarkerList.length, 2); + expect(getClearMarkerList.first!.options.infoWindow.title, 'Jyväskylä'); + expect(getClearMarkerList.last!.options.infoWindow.title, 'Oulu Office'); + + /// Test clearMarkers() function works. + await viewController.clearMarkers(); + + getClearMarkerList = await viewController.getMarkers(); + expect(getClearMarkerList, isEmpty); + + /// Test clear() function clears also markers. + clearMarkerList = await viewController + .addMarkers([markerOneOptions, markerTwoOptions]); + getClearMarkerList = await viewController.getMarkers(); + expect(clearMarkerList.length, 2); + expect(getClearMarkerList.length, 2); + + await viewController.clear(); + getClearMarkerList = await viewController.getMarkers(); + expect(getClearMarkerList, isEmpty); + }); + } + + for (final TestMapType testMapType in testMapTypes) { + patrol('Test polylines (${testMapType.name})', + (PatrolIntegrationTester $) async { + /// The events are not tested because there's currently no reliable way to trigger them. + void onPolylineClicked(String event) { + debugPrint('Polyline clicked event: $event.'); + } + + /// Get viewController for the test type (navigation map or regular map). + final GoogleMapViewController viewController = + await getMapViewControllerForTestMapType($, + testMapType: testMapType, onPolylineClicked: onPolylineClicked); + + await viewController.addPolylines( + [ + const PolylineOptions( + points: [ + LatLng(latitude: 60.186492, longitude: 24.929471), + LatLng(latitude: 60.286492, longitude: 25.929471) + ], + clickable: true, + geodesic: true, + strokeColor: Colors.red, + strokeWidth: 5.0, + ), + ], + ); + + /// Test that received polylines match the ones that were added. + final List polylines = await viewController.getPolylines(); + expect(polylines.length, 1); + expect(polylines[0]!.options.points!.first.latitude, + closeTo(60.186492, 0.01)); + expect(polylines[0]!.options.points!.first.longitude, + closeTo(24.929471, 0.01)); + expect( + polylines[0]!.options.points![1].latitude, closeTo(60.286492, 0.01)); + expect( + polylines[0]!.options.points![1].longitude, closeTo(25.929471, 0.01)); + expect(polylines[0]!.options.clickable, true); + expect(polylines[0]!.options.geodesic, true); + expect(polylines[0]!.options.strokeColor!.value, Colors.red.value); + expect(polylines[0]!.options.strokeWidth, 5.0); + + /// iOS doesn't have strokeJointTypes + if (Platform.isIOS) { + expect(polylines[0]!.options.strokeJointType, null); + } else if (Platform.isAndroid) { + expect(polylines[0]!.options.strokeJointType, + StrokeJointType.defaultJoint); + } + expect(polylines[0]!.options.strokePattern, null); + expect(polylines[0]!.options.visible, true); + expect(polylines[0]!.options.zIndex, 0); + expect(polylines[0]!.options.spans, []); + + await viewController.clearPolylines(); + + /// Test updating polylines + await viewController.addPolylines( + [ + const PolylineOptions( + points: [ + LatLng(latitude: 60.186492, longitude: 24.929471), + LatLng(latitude: 60.286492, longitude: 25.929471), + ], + ) + ], + ); + + /// Test that polylines were ceated with default values. + final List receivedPolylines = + await viewController.getPolylines(); + expect(receivedPolylines.length, 1); + expect(receivedPolylines[0]!.options.geodesic, false); + expect(receivedPolylines[0]!.options.clickable, false); + expect( + receivedPolylines[0]!.options.strokeColor!.value, Colors.black.value); + expect(receivedPolylines[0]!.options.strokeWidth, 10.0); + + /// iOS doesn't have strokeJointTypes + if (Platform.isIOS) { + expect(polylines[0]!.options.strokeJointType, null); + } else if (Platform.isAndroid) { + expect(polylines[0]!.options.strokeJointType, + StrokeJointType.defaultJoint); + } + expect(receivedPolylines[0]!.options.strokePattern, null); + expect(receivedPolylines[0]!.options.visible, true); + expect(receivedPolylines[0]!.options.zIndex, 0); + expect(receivedPolylines[0]!.options.spans, []); + + final Polyline updatedPolyline = Polyline( + polylineId: receivedPolylines[0]!.polylineId, + options: const PolylineOptions( points: [ LatLng(latitude: 60.186492, longitude: 24.929471), LatLng(latitude: 60.286492, longitude: 25.929471) ], clickable: true, geodesic: true, - strokeColor: Colors.red, - strokeWidth: 5.0, ), - ], - ); - - /// Test that received polylines match the ones that were added. - final List polylines = await viewController.getPolylines(); - expect(polylines.length, 1); - expect( - polylines[0]!.options.points!.first.latitude, closeTo(60.186492, 0.01)); - expect(polylines[0]!.options.points!.first.longitude, - closeTo(24.929471, 0.01)); - expect(polylines[0]!.options.points![1].latitude, closeTo(60.286492, 0.01)); - expect( - polylines[0]!.options.points![1].longitude, closeTo(25.929471, 0.01)); - expect(polylines[0]!.options.clickable, true); - expect(polylines[0]!.options.geodesic, true); - expect(polylines[0]!.options.strokeColor!.value, Colors.red.value); - expect(polylines[0]!.options.strokeWidth, 5.0); - - /// iOS doesn't have strokeJointTypes - if (Platform.isIOS) { - expect(polylines[0]!.options.strokeJointType, null); - } else if (Platform.isAndroid) { - expect( - polylines[0]!.options.strokeJointType, StrokeJointType.defaultJoint); - } - expect(polylines[0]!.options.strokePattern, null); - expect(polylines[0]!.options.visible, true); - expect(polylines[0]!.options.zIndex, 0); - expect(polylines[0]!.options.spans, []); - - await viewController.clearPolylines(); - - /// Test updating polylines - await viewController.addPolylines( - [ - const PolylineOptions( - points: [ - LatLng(latitude: 60.186492, longitude: 24.929471), - LatLng(latitude: 60.286492, longitude: 25.929471), - ], - ) - ], - ); - - /// Test that polylines were ceated with default values. - final List receivedPolylines = - await viewController.getPolylines(); - expect(receivedPolylines.length, 1); - expect(receivedPolylines[0]!.options.geodesic, false); - expect(receivedPolylines[0]!.options.clickable, false); - expect( - receivedPolylines[0]!.options.strokeColor!.value, Colors.black.value); - expect(receivedPolylines[0]!.options.strokeWidth, 10.0); - - /// iOS doesn't have strokeJointTypes - if (Platform.isIOS) { - expect(polylines[0]!.options.strokeJointType, null); - } else if (Platform.isAndroid) { - expect( - polylines[0]!.options.strokeJointType, StrokeJointType.defaultJoint); - } - expect(receivedPolylines[0]!.options.strokePattern, null); - expect(receivedPolylines[0]!.options.visible, true); - expect(receivedPolylines[0]!.options.zIndex, 0); - expect(receivedPolylines[0]!.options.spans, []); - - final Polyline updatedPolyline = Polyline( - polylineId: receivedPolylines[0]!.polylineId, - options: const PolylineOptions( - points: [ - LatLng(latitude: 60.186492, longitude: 24.929471), - LatLng(latitude: 60.286492, longitude: 25.929471) + ); + + await viewController.updatePolylines([updatedPolyline]); + + final List receivedPolylines2 = + await viewController.getPolylines(); + expect(receivedPolylines2.length, 1); + expect(receivedPolylines2[0]!.options.geodesic, true); + expect(receivedPolylines2[0]!.options.clickable, true); + + await viewController.clearPolylines(); + + /// Test deleting polylines. + await viewController.addPolylines( + [ + const PolylineOptions( + points: [ + LatLng(latitude: 60.186492, longitude: 24.929471), + LatLng(latitude: 60.286492, longitude: 25.929471), + ], + ), + const PolylineOptions( + points: [ + LatLng(latitude: 61.186492, longitude: 22.929471), + LatLng(latitude: 61.286492, longitude: 22.929471), + ], + ) ], - clickable: true, - geodesic: true, - ), - ); - - await viewController.updatePolylines([updatedPolyline]); - - final List receivedPolylines2 = - await viewController.getPolylines(); - expect(receivedPolylines2.length, 1); - expect(receivedPolylines2[0]!.options.geodesic, true); - expect(receivedPolylines2[0]!.options.clickable, true); - - await viewController.clearPolylines(); - - /// Test deleting polylines. - await viewController.addPolylines( - [ - const PolylineOptions( - points: [ - LatLng(latitude: 60.186492, longitude: 24.929471), - LatLng(latitude: 60.286492, longitude: 25.929471), - ], - ), - const PolylineOptions( - points: [ - LatLng(latitude: 61.186492, longitude: 22.929471), - LatLng(latitude: 61.286492, longitude: 22.929471), - ], - ) - ], - ); - - final List receivedPolylines3 = - await viewController.getPolylines(); - expect(receivedPolylines3.length, 2); - - await viewController.removePolylines([receivedPolylines3[0]!]); - - final List receivedPolylines4 = - await viewController.getPolylines(); - expect(receivedPolylines4.length, 1); + ); - /// Test that right polyline was removed. - expect( - receivedPolylines4[0]!.polylineId, receivedPolylines3[1]!.polylineId); + final List receivedPolylines3 = + await viewController.getPolylines(); + expect(receivedPolylines3.length, 2); - /// Test that trying to remove or update a polyline that doesn't exist - /// throws error. - try { await viewController.removePolylines([receivedPolylines3[0]!]); - fail( - 'Expected removePolylines() to fail with PolylineNotFoundException.'); - } on PolylineNotFoundException catch (e) { - expect(e, isNotNull); - } - try { - await viewController.updatePolylines([receivedPolylines3[0]!]); - fail('Expected updatePolylines to fail with PolylineNotFoundException.'); - } on PolylineNotFoundException catch (e) { - expect(e, isNotNull); - } - - await viewController.clearPolylines(); - - /// Test clearning all polylines. - await viewController.addPolylines( - [ - const PolylineOptions( - points: [ - LatLng(latitude: 60.186492, longitude: 24.929471), - LatLng(latitude: 60.286492, longitude: 25.929471), - ], - ), - const PolylineOptions( - points: [ - LatLng(latitude: 61.186492, longitude: 22.929471), - LatLng(latitude: 61.286492, longitude: 22.929471), - ], - ) - ], - ); - final List receivedPolylines5 = - await viewController.getPolylines(); - expect(receivedPolylines5.length, 2); + final List receivedPolylines4 = + await viewController.getPolylines(); + expect(receivedPolylines4.length, 1); - await viewController.clearPolylines(); - - final List receivedPolylines6 = - await viewController.getPolylines(); - expect(receivedPolylines6.length, 0); + /// Test that right polyline was removed. + expect( + receivedPolylines4[0]!.polylineId, receivedPolylines3[1]!.polylineId); + + /// Test that trying to remove or update a polyline that doesn't exist + /// throws error. + try { + await viewController + .removePolylines([receivedPolylines3[0]!]); + fail( + 'Expected removePolylines() to fail with PolylineNotFoundException.'); + } on PolylineNotFoundException catch (e) { + expect(e, isNotNull); + } + try { + await viewController + .updatePolylines([receivedPolylines3[0]!]); + fail( + 'Expected updatePolylines to fail with PolylineNotFoundException.'); + } on PolylineNotFoundException catch (e) { + expect(e, isNotNull); + } + + await viewController.clearPolylines(); + + /// Test clearning all polylines. + await viewController.addPolylines( + [ + const PolylineOptions( + points: [ + LatLng(latitude: 60.186492, longitude: 24.929471), + LatLng(latitude: 60.286492, longitude: 25.929471), + ], + ), + const PolylineOptions( + points: [ + LatLng(latitude: 61.186492, longitude: 22.929471), + LatLng(latitude: 61.286492, longitude: 22.929471), + ], + ) + ], + ); + + final List receivedPolylines5 = + await viewController.getPolylines(); + expect(receivedPolylines5.length, 2); + + await viewController.clearPolylines(); + + final List receivedPolylines6 = + await viewController.getPolylines(); + expect(receivedPolylines6.length, 0); + + /// Test clearing all polylines with clear(). + await viewController.addPolylines( + [ + const PolylineOptions( + points: [ + LatLng(latitude: 60.186492, longitude: 24.929471), + LatLng(latitude: 60.286492, longitude: 25.929471), + ], + ), + const PolylineOptions( + points: [ + LatLng(latitude: 61.186492, longitude: 22.929471), + LatLng(latitude: 61.286492, longitude: 22.929471), + ], + ) + ], + ); + + final List receivedPolylines7 = + await viewController.getPolylines(); + expect(receivedPolylines7.length, 2); + + await viewController.clear(); + + final List receivedPolylines8 = + await viewController.getPolylines(); + expect(receivedPolylines8.length, 0); + }); + } + + for (final TestMapType testMapType in testMapTypes) { + patrol('Polygon tests (${testMapType.name})', + (PatrolIntegrationTester $) async { + void onPolygonClicked(String event) { + /// The events are not tested because there's currently no reliable way to trigger them. + debugPrint('Polygon clicked event: $event.'); + } + + /// Get viewController for the test type (navigation map or regular map). + final GoogleMapViewController viewController = + await getMapViewControllerForTestMapType($, + testMapType: testMapType, onPolygonClicked: onPolygonClicked); + + /// Creates square, 4 coordinates, from top left and bottom right coordinates. + List createSquare(LatLng topLeft, LatLng bottomRight) { + return [ + topLeft, + LatLng(latitude: topLeft.latitude, longitude: bottomRight.longitude), + bottomRight, + LatLng(latitude: bottomRight.latitude, longitude: topLeft.longitude) + ]; + } + + // Add square polygon on the current camera position. + final CameraPosition position = await viewController.getCameraPosition(); + + // Calculate suitable offset for coordinates from the current zoom level. + final double offset = (30.0 - position.zoom) * 0.04; + + /// Creates list of 2 coordinates, for two opposite corners of the square. + /// Each point is offset away from the center point. + final LatLng topLeft = LatLng( + latitude: position.target.latitude + offset, + longitude: position.target.longitude - offset); + final LatLng bottomRight = LatLng( + latitude: position.target.latitude - offset, + longitude: position.target.longitude + offset); + + final List points = createSquare(topLeft, bottomRight); + + // Get min and max coordinates from the existing polygon. + final double minLatitude = + points.map((LatLng e) => e.latitude).reduce(min); + final double maxLatitude = + points.map((LatLng e) => e.latitude).reduce(max); + final double minLongitude = + points.map((LatLng e) => e.longitude).reduce(min); + final double maxLongitude = + points.map((LatLng e) => e.longitude).reduce(max); + final double width = maxLatitude - minLatitude; + + // Create hole that is 40% of the total rectangle width, + // hole will be 10% of width away from the bottom right corner. + final LatLng holeTopLeft = LatLng( + latitude: minLatitude + (width * 0.1), + longitude: minLongitude + (width * 0.1)); + final LatLng holeBottomRight = LatLng( + latitude: minLatitude + (width * 0.4), + longitude: minLongitude + (width * 0.4)); + final List hole1 = createSquare(holeTopLeft, holeBottomRight); + + // Create hole that is 40% of the total rectangle width, + // hole will be 10% of width away from the top left corner. + final LatLng holeTopLeft2 = LatLng( + latitude: maxLatitude - (width * 0.1), + longitude: maxLongitude - (width * 0.1)); + final LatLng holeBottomRight2 = LatLng( + latitude: maxLatitude - (width * 0.4), + longitude: maxLongitude - (width * 0.4)); + final List hole2 = createSquare(holeTopLeft2, holeBottomRight2); + final List> holes = >[hole1, hole2]; + + final PolygonOptions options = + PolygonOptions(points: points, holes: holes); + final List polygons = + await viewController.addPolygons([options]); + List getPolygons = await viewController.getPolygons(); + + /// There's automatically extra LatLng point added on Android if the + /// last LatLng value of the list doesn't match the first one. + if (Platform.isAndroid) { + getPolygons[0]!.options.points.removeLast(); + getPolygons[0]!.options.holes[0].removeLast(); + getPolygons[0]!.options.holes[1].removeLast(); + } + final List polygonList = [ + polygons[0]!, + getPolygons[0]! + ]; - /// Test clearing all polylines with clear(). - await viewController.addPolylines( - [ - const PolylineOptions( - points: [ - LatLng(latitude: 60.186492, longitude: 24.929471), - LatLng(latitude: 60.286492, longitude: 25.929471), - ], - ), - const PolylineOptions( - points: [ - LatLng(latitude: 61.186492, longitude: 22.929471), - LatLng(latitude: 61.286492, longitude: 22.929471), - ], - ) - ], - ); + /// Test PolygonOptions default values against addPolygons and getPolygons responses. + for (final Polygon polygon in polygonList) { + expect(polygon.polygonId, 'Polygon_0'); + expect(polygon.options.points, options.points); + expect(polygon.options.holes, options.holes); + + // Default values. + expect(polygon.options.clickable, false); + expect(polygon.options.fillColor, Colors.black); + expect(polygon.options.geodesic, false); + expect(polygon.options.strokeColor, Colors.black); + expect(polygon.options.strokeWidth, 10); + expect(polygon.options.visible, true); + expect(polygon.options.zIndex, 0); + } + + final LatLng updatedTopLeft = LatLng( + latitude: topLeft.latitude + 1, longitude: topLeft.longitude + 1); + final LatLng updatedBottomRight = LatLng( + latitude: bottomRight.latitude + 1, + longitude: bottomRight.longitude + 1); + final LatLng updatedHoleTopLeft = LatLng( + latitude: holeTopLeft.latitude + 1, + longitude: holeTopLeft.longitude + 1); + final LatLng updatedHoleBottomRight = LatLng( + latitude: holeBottomRight.latitude + 1, + longitude: holeBottomRight.longitude + 1); + final LatLng updatedHoleTopLeft2 = LatLng( + latitude: holeTopLeft.latitude + 1, + longitude: holeTopLeft.longitude + 1); + final LatLng updatedHoleBottomRight2 = LatLng( + latitude: holeBottomRight2.latitude + 1, + longitude: holeBottomRight2.longitude + 1); + + final List updatedPoints = + createSquare(updatedTopLeft, updatedBottomRight); + final List updatedHole = + createSquare(updatedHoleTopLeft, updatedHoleBottomRight); + final List updatedHole2 = + createSquare(updatedHoleTopLeft2, updatedHoleBottomRight2); + final List> updatedHoles = >[ + updatedHole, + updatedHole2 + ]; - final List receivedPolylines7 = - await viewController.getPolylines(); - expect(receivedPolylines7.length, 2); + /// New polygon options with non-default values. + final PolygonOptions updatedOptions = PolygonOptions( + points: updatedPoints, + holes: updatedHoles, + clickable: true, + fillColor: Colors.white, + geodesic: true, + strokeColor: Colors.white, + strokeWidth: 15, + visible: false, + zIndex: 1, + ); + + final Polygon updatedPolygon = + polygons.first!.copyWith(options: updatedOptions); + + /// Update polygons with new options and check polygon is updated + /// and not duplicated. + final List updatedPolygons = + await viewController.updatePolygons([updatedPolygon]); + expect(updatedPolygons.length, 1); + + /// Get updated polygons. + getPolygons = await viewController.getPolygons(); + expect(getPolygons.length, 1); + + /// There's automatically extra LatLng point added on Android if the + /// last LatLng value of the list doesn't match the first one. + if (Platform.isAndroid) { + getPolygons[0]!.options.points.removeLast(); + getPolygons[0]!.options.holes[0].removeLast(); + getPolygons[0]!.options.holes[1].removeLast(); + } + + final List updatedPolygonList = [ + updatedPolygons[0]!, + getPolygons[0]! + ]; - await viewController.clear(); + /// Test PolygonOptions updated values against updatePolygons and getPolygons responses. + for (final Polygon updatedPolygon in updatedPolygonList) { + expect(updatedPolygon.polygonId, 'Polygon_0'); + expect(updatedPolygon.options.points, updatedOptions.points); + expect(updatedPolygon.options.holes, updatedOptions.holes); + expect(updatedPolygon.options.clickable, updatedOptions.clickable); + expect(updatedPolygon.options.fillColor, updatedOptions.fillColor); + expect(updatedPolygon.options.geodesic, updatedOptions.geodesic); + expect(updatedPolygon.options.strokeColor, updatedOptions.strokeColor); + expect(updatedPolygon.options.strokeWidth, updatedOptions.strokeWidth); + expect(updatedPolygon.options.visible, updatedOptions.visible); + expect(updatedPolygon.options.zIndex, updatedOptions.zIndex); + } + + /// Add a second polygon with the updated options and test order + /// and custom options. + final List polygons2 = + await viewController.addPolygons([updatedOptions]); + expect(polygons2.length, 1); + expect(polygons2[0]!.polygonId, 'Polygon_1'); + + getPolygons = await viewController.getPolygons(); + expect(getPolygons.length, 2); + expect(getPolygons[0]!.polygonId, 'Polygon_0'); + expect(getPolygons[1]!.polygonId, 'Polygon_1'); + + final List polygonList2 = [ + polygons2[0]!, + getPolygons[1]!, + ]; - final List receivedPolylines8 = - await viewController.getPolylines(); - expect(receivedPolylines8.length, 0); - }); + for (final Polygon polygon in polygonList2) { + expect(polygon.options.clickable, updatedOptions.clickable); + expect(polygon.options.fillColor, updatedOptions.fillColor); + expect(polygon.options.geodesic, updatedOptions.geodesic); + expect(polygon.options.strokeColor, updatedOptions.strokeColor); + expect(polygon.options.strokeWidth, updatedOptions.strokeWidth); + expect(polygon.options.visible, updatedOptions.visible); + expect(polygon.options.zIndex, updatedOptions.zIndex); + } + + /// Add third polygon with original options. + final List polygons3 = + await viewController.addPolygons([options]); + expect(polygons3.length, 1); + expect(polygons3[0]!.polygonId, 'Polygon_2'); + + getPolygons = await viewController.getPolygons(); + expect(getPolygons.length, 3); + expect(getPolygons[0]!.polygonId, 'Polygon_0'); + expect(getPolygons[1]!.polygonId, 'Polygon_1'); + expect(getPolygons[2]!.polygonId, 'Polygon_2'); + + /// Test removing the first polygon. + await viewController.removePolygons([getPolygons.first!]); + + getPolygons = await viewController.getPolygons(); + expect(getPolygons.length, 2); + expect(getPolygons[0]!.polygonId, 'Polygon_1'); + expect(getPolygons[1]!.polygonId, 'Polygon_2'); + + /// Test removing the last polygon. + await viewController.removePolygons([getPolygons.last!]); + + getPolygons = await viewController.getPolygons(); + expect(getPolygons.length, 1); + expect(getPolygons[0]!.polygonId, 'Polygon_1'); + + /// Add multiple polygons to test clearPolygons(). + final List polygons4 = await viewController + .addPolygons([updatedOptions, options, options]); + + expect(polygons4.length, 3); + expect(polygons4[0]!.polygonId, 'Polygon_3'); + expect(polygons4[1]!.polygonId, 'Polygon_4'); + expect(polygons4[2]!.polygonId, 'Polygon_5'); + + getPolygons = await viewController.getPolygons(); + expect(getPolygons.length, 4); + expect(getPolygons[0]!.polygonId, 'Polygon_1'); + expect(getPolygons[1]!.polygonId, 'Polygon_3'); + expect(getPolygons[2]!.polygonId, 'Polygon_4'); + expect(getPolygons[3]!.polygonId, 'Polygon_5'); + + /// Test clearPolygons(). + await viewController.clearPolygons(); + getPolygons = await viewController.getPolygons(); + expect(getPolygons, isEmpty); + + /// Add polygons to test clear(). + final List polygons5 = + await viewController.addPolygons([ + updatedOptions, + options, + options, + updatedOptions, + options, + ]); + + expect(polygons5.length, 5); + + getPolygons = await viewController.getPolygons(); + expect(getPolygons.length, 5); + + /// Test that trying to remove or update a polyline that doesn't exist + /// throws error. + try { + await viewController.removePolygons([updatedPolygon]); + fail( + 'Expected removePolylines() to fail with PolygonNotFoundException.'); + } on PolygonNotFoundException catch (e) { + expect(e, isNotNull); + } + try { + await viewController.updatePolygons([updatedPolygon]); + fail( + 'Expected updatePolylines() to fail with PolygonNotFoundException'); + } on PolygonNotFoundException catch (e) { + expect(e, isNotNull); + } + + /// Test clear() removes all polygons. + await viewController.clear(); + + getPolygons = await viewController.getPolygons(); + expect(getPolygons, isEmpty); + }); + } + + for (final TestMapType testMapType in testMapTypes) { + patrol('Circle tests (${testMapType.name})', + (PatrolIntegrationTester $) async { + void onCircleClicked(String event) { + /// The events are not tested because there's currently no reliable way to trigger them. + debugPrint('Circle clicked event: $event.'); + } + + /// Get viewController for the test type (navigation map or regular map). + final GoogleMapViewController viewController = + await getMapViewControllerForTestMapType($, + testMapType: testMapType, onCircleClicked: onCircleClicked); + + // Add circle on the current camera position. + final CameraPosition position = await viewController.getCameraPosition(); + + final CircleOptions options = + CircleOptions(position: position.target, radius: 5000); + final List circles = + await viewController.addCircles([options]); + List getCircles = await viewController.getCircles(); + + final List circleList = [circles[0]!, getCircles[0]!]; + + /// Test CircleOptions default values against addCircles and getCircles responses. + for (final Circle circle in circleList) { + expect(circle.circleId, 'Circle_0'); + expect(circle.options.position, options.position); + expect(circle.options.radius, options.radius); + + // Default values. + expect(circle.options.clickable, false); + expect(circle.options.fillColor, Colors.black); + expect(circle.options.strokeColor, Colors.black); + expect(circle.options.strokeWidth, 10); + expect(circle.options.strokePattern, circle.options.strokePattern); + expect(circle.options.visible, true); + expect(circle.options.zIndex, 0); + } + + final LatLng updatedPosition = LatLng( + latitude: position.target.latitude + 1, + longitude: position.target.longitude + 1); + + /// New circle options with non-default values. + final CircleOptions updatedOptions = CircleOptions( + position: updatedPosition, + radius: 50000, + clickable: true, + fillColor: Colors.white, + strokeColor: Colors.white, + strokeWidth: 15, + visible: false, + zIndex: 1, + ); + + final Circle updatedCircle = + circles.first!.copyWith(options: updatedOptions); + + /// Update circles with new options and check circle is updated + /// and not duplicated. + final List updatedCircles = + await viewController.updateCircles([updatedCircle]); + expect(updatedCircles.length, 1); + + /// Get updated circles. + getCircles = await viewController.getCircles(); + expect(getCircles.length, 1); + + final List updatedCircleList = [ + updatedCircles[0]!, + getCircles[0]! + ]; - patrol('Polygon tests', (PatrolIntegrationTester $) async { - void onPolygonClicked(String event) { - /// The events are not tested because there's currently no reliable way to trigger them. - debugPrint('Polygon clicked event: $event.'); - } - - /// Set up navigation and test setting up the callback listener. - final GoogleNavigationViewController viewController = - await startNavigationWithoutDestination($, - onPolygonClicked: onPolygonClicked); - - /// Creates square, 4 coordinates, from top left and bottom right coordinates. - List createSquare(LatLng topLeft, LatLng bottomRight) { - return [ - topLeft, - LatLng(latitude: topLeft.latitude, longitude: bottomRight.longitude), - bottomRight, - LatLng(latitude: bottomRight.latitude, longitude: topLeft.longitude) + /// Test CircleOptions updated values against updateCircles and getCircles responses. + for (final Circle updatedCircle in updatedCircleList) { + expect(updatedCircle.circleId, 'Circle_0'); + expect(updatedCircle.options.position, updatedOptions.position); + expect(updatedCircle.options.radius, updatedOptions.radius); + expect(updatedCircle.options.clickable, updatedOptions.clickable); + expect(updatedCircle.options.fillColor, updatedOptions.fillColor); + expect(updatedCircle.options.strokeColor, updatedOptions.strokeColor); + expect(updatedCircle.options.strokeWidth, updatedOptions.strokeWidth); + expect( + updatedCircle.options.strokePattern, updatedOptions.strokePattern); + expect(updatedCircle.options.visible, updatedOptions.visible); + expect(updatedCircle.options.zIndex, updatedOptions.zIndex); + } + + /// Add a second circle with the updated options and test order + /// and custom options. + final List circles2 = + await viewController.addCircles([updatedOptions]); + expect(circles2.length, 1); + expect(circles2[0]!.circleId, 'Circle_1'); + + getCircles = await viewController.getCircles(); + expect(getCircles.length, 2); + expect(getCircles[0]!.circleId, 'Circle_0'); + expect(getCircles[1]!.circleId, 'Circle_1'); + + final List circleList2 = [ + circles2[0]!, + getCircles[1]!, ]; - } - - // Add square polygon on the current camera position. - final CameraPosition position = await viewController.getCameraPosition(); - - // Calculate suitable offset for coordinates from the current zoom level. - final double offset = (30.0 - position.zoom) * 0.04; - - /// Creates list of 2 coordinates, for two opposite corners of the square. - /// Each point is offset away from the center point. - final LatLng topLeft = LatLng( - latitude: position.target.latitude + offset, - longitude: position.target.longitude - offset); - final LatLng bottomRight = LatLng( - latitude: position.target.latitude - offset, - longitude: position.target.longitude + offset); - - final List points = createSquare(topLeft, bottomRight); - - // Get min and max coordinates from the existing polygon. - final double minLatitude = points.map((LatLng e) => e.latitude).reduce(min); - final double maxLatitude = points.map((LatLng e) => e.latitude).reduce(max); - final double minLongitude = - points.map((LatLng e) => e.longitude).reduce(min); - final double maxLongitude = - points.map((LatLng e) => e.longitude).reduce(max); - final double width = maxLatitude - minLatitude; - - // Create hole that is 40% of the total rectangle width, - // hole will be 10% of width away from the bottom right corner. - final LatLng holeTopLeft = LatLng( - latitude: minLatitude + (width * 0.1), - longitude: minLongitude + (width * 0.1)); - final LatLng holeBottomRight = LatLng( - latitude: minLatitude + (width * 0.4), - longitude: minLongitude + (width * 0.4)); - final List hole1 = createSquare(holeTopLeft, holeBottomRight); - - // Create hole that is 40% of the total rectangle width, - // hole will be 10% of width away from the top left corner. - final LatLng holeTopLeft2 = LatLng( - latitude: maxLatitude - (width * 0.1), - longitude: maxLongitude - (width * 0.1)); - final LatLng holeBottomRight2 = LatLng( - latitude: maxLatitude - (width * 0.4), - longitude: maxLongitude - (width * 0.4)); - final List hole2 = createSquare(holeTopLeft2, holeBottomRight2); - final List> holes = >[hole1, hole2]; - - final PolygonOptions options = PolygonOptions(points: points, holes: holes); - final List polygons = - await viewController.addPolygons([options]); - List getPolygons = await viewController.getPolygons(); - - /// There's automatically extra LatLng point added on Android if the - /// last LatLng value of the list doesn't match the first one. - if (Platform.isAndroid) { - getPolygons[0]!.options.points.removeLast(); - getPolygons[0]!.options.holes[0].removeLast(); - getPolygons[0]!.options.holes[1].removeLast(); - } - final List polygonList = [polygons[0]!, getPolygons[0]!]; - - /// Test PolygonOptions default values against addPolygons and getPolygons responses. - for (final Polygon polygon in polygonList) { - expect(polygon.polygonId, 'Polygon_0'); - expect(polygon.options.points, options.points); - expect(polygon.options.holes, options.holes); - - // Default values. - expect(polygon.options.clickable, false); - expect(polygon.options.fillColor, Colors.black); - expect(polygon.options.geodesic, false); - expect(polygon.options.strokeColor, Colors.black); - expect(polygon.options.strokeWidth, 10); - expect(polygon.options.visible, true); - expect(polygon.options.zIndex, 0); - } - - final LatLng updatedTopLeft = LatLng( - latitude: topLeft.latitude + 1, longitude: topLeft.longitude + 1); - final LatLng updatedBottomRight = LatLng( - latitude: bottomRight.latitude + 1, - longitude: bottomRight.longitude + 1); - final LatLng updatedHoleTopLeft = LatLng( - latitude: holeTopLeft.latitude + 1, - longitude: holeTopLeft.longitude + 1); - final LatLng updatedHoleBottomRight = LatLng( - latitude: holeBottomRight.latitude + 1, - longitude: holeBottomRight.longitude + 1); - final LatLng updatedHoleTopLeft2 = LatLng( - latitude: holeTopLeft.latitude + 1, - longitude: holeTopLeft.longitude + 1); - final LatLng updatedHoleBottomRight2 = LatLng( - latitude: holeBottomRight2.latitude + 1, - longitude: holeBottomRight2.longitude + 1); - - final List updatedPoints = - createSquare(updatedTopLeft, updatedBottomRight); - final List updatedHole = - createSquare(updatedHoleTopLeft, updatedHoleBottomRight); - final List updatedHole2 = - createSquare(updatedHoleTopLeft2, updatedHoleBottomRight2); - final List> updatedHoles = >[ - updatedHole, - updatedHole2 - ]; - - /// New polygon options with non-default values. - final PolygonOptions updatedOptions = PolygonOptions( - points: updatedPoints, - holes: updatedHoles, - clickable: true, - fillColor: Colors.white, - geodesic: true, - strokeColor: Colors.white, - strokeWidth: 15, - visible: false, - zIndex: 1, - ); - - final Polygon updatedPolygon = - polygons.first!.copyWith(options: updatedOptions); - - /// Update polygons with new options and check polygon is updated - /// and not duplicated. - final List updatedPolygons = - await viewController.updatePolygons([updatedPolygon]); - expect(updatedPolygons.length, 1); - - /// Get updated polygons. - getPolygons = await viewController.getPolygons(); - expect(getPolygons.length, 1); - - /// There's automatically extra LatLng point added on Android if the - /// last LatLng value of the list doesn't match the first one. - if (Platform.isAndroid) { - getPolygons[0]!.options.points.removeLast(); - getPolygons[0]!.options.holes[0].removeLast(); - getPolygons[0]!.options.holes[1].removeLast(); - } - - final List updatedPolygonList = [ - updatedPolygons[0]!, - getPolygons[0]! - ]; - - /// Test PolygonOptions updated values against updatePolygons and getPolygons responses. - for (final Polygon updatedPolygon in updatedPolygonList) { - expect(updatedPolygon.polygonId, 'Polygon_0'); - expect(updatedPolygon.options.points, updatedOptions.points); - expect(updatedPolygon.options.holes, updatedOptions.holes); - expect(updatedPolygon.options.clickable, updatedOptions.clickable); - expect(updatedPolygon.options.fillColor, updatedOptions.fillColor); - expect(updatedPolygon.options.geodesic, updatedOptions.geodesic); - expect(updatedPolygon.options.strokeColor, updatedOptions.strokeColor); - expect(updatedPolygon.options.strokeWidth, updatedOptions.strokeWidth); - expect(updatedPolygon.options.visible, updatedOptions.visible); - expect(updatedPolygon.options.zIndex, updatedOptions.zIndex); - } - - /// Add a second polygon with the updated options and test order - /// and custom options. - final List polygons2 = - await viewController.addPolygons([updatedOptions]); - expect(polygons2.length, 1); - expect(polygons2[0]!.polygonId, 'Polygon_1'); - - getPolygons = await viewController.getPolygons(); - expect(getPolygons.length, 2); - expect(getPolygons[0]!.polygonId, 'Polygon_0'); - expect(getPolygons[1]!.polygonId, 'Polygon_1'); - - final List polygonList2 = [ - polygons2[0]!, - getPolygons[1]!, - ]; - - for (final Polygon polygon in polygonList2) { - expect(polygon.options.clickable, updatedOptions.clickable); - expect(polygon.options.fillColor, updatedOptions.fillColor); - expect(polygon.options.geodesic, updatedOptions.geodesic); - expect(polygon.options.strokeColor, updatedOptions.strokeColor); - expect(polygon.options.strokeWidth, updatedOptions.strokeWidth); - expect(polygon.options.visible, updatedOptions.visible); - expect(polygon.options.zIndex, updatedOptions.zIndex); - } - - /// Add third polygon with original options. - final List polygons3 = - await viewController.addPolygons([options]); - expect(polygons3.length, 1); - expect(polygons3[0]!.polygonId, 'Polygon_2'); - - getPolygons = await viewController.getPolygons(); - expect(getPolygons.length, 3); - expect(getPolygons[0]!.polygonId, 'Polygon_0'); - expect(getPolygons[1]!.polygonId, 'Polygon_1'); - expect(getPolygons[2]!.polygonId, 'Polygon_2'); - - /// Test removing the first polygon. - await viewController.removePolygons([getPolygons.first!]); - - getPolygons = await viewController.getPolygons(); - expect(getPolygons.length, 2); - expect(getPolygons[0]!.polygonId, 'Polygon_1'); - expect(getPolygons[1]!.polygonId, 'Polygon_2'); - - /// Test removing the last polygon. - await viewController.removePolygons([getPolygons.last!]); - - getPolygons = await viewController.getPolygons(); - expect(getPolygons.length, 1); - expect(getPolygons[0]!.polygonId, 'Polygon_1'); - - /// Add multiple polygons to test clearPolygons(). - final List polygons4 = await viewController - .addPolygons([updatedOptions, options, options]); - - expect(polygons4.length, 3); - expect(polygons4[0]!.polygonId, 'Polygon_3'); - expect(polygons4[1]!.polygonId, 'Polygon_4'); - expect(polygons4[2]!.polygonId, 'Polygon_5'); - - getPolygons = await viewController.getPolygons(); - expect(getPolygons.length, 4); - expect(getPolygons[0]!.polygonId, 'Polygon_1'); - expect(getPolygons[1]!.polygonId, 'Polygon_3'); - expect(getPolygons[2]!.polygonId, 'Polygon_4'); - expect(getPolygons[3]!.polygonId, 'Polygon_5'); - - /// Test clearPolygons(). - await viewController.clearPolygons(); - getPolygons = await viewController.getPolygons(); - expect(getPolygons, isEmpty); - - /// Add polygons to test clear(). - final List polygons5 = - await viewController.addPolygons([ - updatedOptions, - options, - options, - updatedOptions, - options, - ]); - - expect(polygons5.length, 5); - - getPolygons = await viewController.getPolygons(); - expect(getPolygons.length, 5); - - /// Test that trying to remove or update a polyline that doesn't exist - /// throws error. - try { - await viewController.removePolygons([updatedPolygon]); - fail('Expected removePolylines() to fail with PolygonNotFoundException.'); - } on PolygonNotFoundException catch (e) { - expect(e, isNotNull); - } - try { - await viewController.updatePolygons([updatedPolygon]); - fail('Expected updatePolylines() to fail with PolygonNotFoundException'); - } on PolygonNotFoundException catch (e) { - expect(e, isNotNull); - } - - /// Test clear() removes all polygons. - await viewController.clear(); - - getPolygons = await viewController.getPolygons(); - expect(getPolygons, isEmpty); - }); - - patrol('Circle tests', (PatrolIntegrationTester $) async { - void onCircleClicked(String event) { - /// The events are not tested because there's currently no reliable way to trigger them. - debugPrint('Circle clicked event: $event.'); - } - - /// Set up navigation and test setting up the callback functions. - final GoogleNavigationViewController viewController = - await startNavigationWithoutDestination($, - onCircleClicked: onCircleClicked); - - // Add circle on the current camera position. - final CameraPosition position = await viewController.getCameraPosition(); - - final CircleOptions options = - CircleOptions(position: position.target, radius: 5000); - final List circles = - await viewController.addCircles([options]); - List getCircles = await viewController.getCircles(); - - final List circleList = [circles[0]!, getCircles[0]!]; - - /// Test CircleOptions default values against addCircles and getCircles responses. - for (final Circle circle in circleList) { - expect(circle.circleId, 'Circle_0'); - expect(circle.options.position, options.position); - expect(circle.options.radius, options.radius); - - // Default values. - expect(circle.options.clickable, false); - expect(circle.options.fillColor, Colors.black); - expect(circle.options.strokeColor, Colors.black); - expect(circle.options.strokeWidth, 10); - expect(circle.options.strokePattern, circle.options.strokePattern); - expect(circle.options.visible, true); - expect(circle.options.zIndex, 0); - } - - final LatLng updatedPosition = LatLng( - latitude: position.target.latitude + 1, - longitude: position.target.longitude + 1); - - /// New circle options with non-default values. - final CircleOptions updatedOptions = CircleOptions( - position: updatedPosition, - radius: 50000, - clickable: true, - fillColor: Colors.white, - strokeColor: Colors.white, - strokeWidth: 15, - visible: false, - zIndex: 1, - ); - - final Circle updatedCircle = - circles.first!.copyWith(options: updatedOptions); - - /// Update circles with new options and check circle is updated - /// and not duplicated. - final List updatedCircles = - await viewController.updateCircles([updatedCircle]); - expect(updatedCircles.length, 1); - - /// Get updated circles. - getCircles = await viewController.getCircles(); - expect(getCircles.length, 1); - - final List updatedCircleList = [ - updatedCircles[0]!, - getCircles[0]! - ]; - - /// Test CircleOptions updated values against updateCircles and getCircles responses. - for (final Circle updatedCircle in updatedCircleList) { - expect(updatedCircle.circleId, 'Circle_0'); - expect(updatedCircle.options.position, updatedOptions.position); - expect(updatedCircle.options.radius, updatedOptions.radius); - expect(updatedCircle.options.clickable, updatedOptions.clickable); - expect(updatedCircle.options.fillColor, updatedOptions.fillColor); - expect(updatedCircle.options.strokeColor, updatedOptions.strokeColor); - expect(updatedCircle.options.strokeWidth, updatedOptions.strokeWidth); - expect(updatedCircle.options.strokePattern, updatedOptions.strokePattern); - expect(updatedCircle.options.visible, updatedOptions.visible); - expect(updatedCircle.options.zIndex, updatedOptions.zIndex); - } - - /// Add a second circle with the updated options and test order - /// and custom options. - final List circles2 = - await viewController.addCircles([updatedOptions]); - expect(circles2.length, 1); - expect(circles2[0]!.circleId, 'Circle_1'); - - getCircles = await viewController.getCircles(); - expect(getCircles.length, 2); - expect(getCircles[0]!.circleId, 'Circle_0'); - expect(getCircles[1]!.circleId, 'Circle_1'); - - final List circleList2 = [ - circles2[0]!, - getCircles[1]!, - ]; - - for (final Circle circle in circleList2) { - expect(circle.options.position, updatedOptions.position); - expect(circle.options.radius, updatedOptions.radius); - expect(circle.options.clickable, updatedOptions.clickable); - expect(circle.options.fillColor, updatedOptions.fillColor); - expect(circle.options.strokePattern, updatedOptions.strokePattern); - expect(circle.options.strokeColor, updatedOptions.strokeColor); - expect(circle.options.strokeWidth, updatedOptions.strokeWidth); - expect(circle.options.visible, updatedOptions.visible); - expect(circle.options.zIndex, updatedOptions.zIndex); - } - - /// Add third circle with original options. - final List circles3 = - await viewController.addCircles([options]); - expect(circles3.length, 1); - expect(circles3[0]!.circleId, 'Circle_2'); - - getCircles = await viewController.getCircles(); - expect(getCircles.length, 3); - expect(getCircles[0]!.circleId, 'Circle_0'); - expect(getCircles[1]!.circleId, 'Circle_1'); - expect(getCircles[2]!.circleId, 'Circle_2'); - - /// Test removing the first circle. - await viewController.removeCircles([getCircles.first!]); - - getCircles = await viewController.getCircles(); - expect(getCircles.length, 2); - expect(getCircles[0]!.circleId, 'Circle_1'); - expect(getCircles[1]!.circleId, 'Circle_2'); - - /// Test removing the last circle. - await viewController.removeCircles([getCircles.last!]); - - getCircles = await viewController.getCircles(); - expect(getCircles.length, 1); - expect(getCircles[0]!.circleId, 'Circle_1'); - - /// Add multiple circles to test clearCircles(). - final List circles4 = await viewController - .addCircles([updatedOptions, options, options]); - - expect(circles4.length, 3); - expect(circles4[0]!.circleId, 'Circle_3'); - expect(circles4[1]!.circleId, 'Circle_4'); - expect(circles4[2]!.circleId, 'Circle_5'); - - getCircles = await viewController.getCircles(); - expect(getCircles.length, 4); - expect(getCircles[0]!.circleId, 'Circle_1'); - expect(getCircles[1]!.circleId, 'Circle_3'); - expect(getCircles[2]!.circleId, 'Circle_4'); - expect(getCircles[3]!.circleId, 'Circle_5'); - - /// Test clearCircles(). - await viewController.clearCircles(); - getCircles = await viewController.getCircles(); - expect(getCircles, isEmpty); - - /// Add circles to test clear(). - final List circles5 = - await viewController.addCircles([ - updatedOptions, - options, - options, - updatedOptions, - options, - ]); - - expect(circles5.length, 5); - - getCircles = await viewController.getCircles(); - expect(getCircles.length, 5); - - /// Test clear() removes all circles. - await viewController.clear(); - - getCircles = await viewController.getCircles(); - expect(getCircles, isEmpty); - - /// Test CircleNotFoundException error on removeCircles(). - try { - await viewController.removeCircles([updatedCircle]); - fail('Expected PlatformException'); - } on CircleNotFoundException catch (e) { - expect(e, isNotNull); - } - }); + + for (final Circle circle in circleList2) { + expect(circle.options.position, updatedOptions.position); + expect(circle.options.radius, updatedOptions.radius); + expect(circle.options.clickable, updatedOptions.clickable); + expect(circle.options.fillColor, updatedOptions.fillColor); + expect(circle.options.strokePattern, updatedOptions.strokePattern); + expect(circle.options.strokeColor, updatedOptions.strokeColor); + expect(circle.options.strokeWidth, updatedOptions.strokeWidth); + expect(circle.options.visible, updatedOptions.visible); + expect(circle.options.zIndex, updatedOptions.zIndex); + } + + /// Add third circle with original options. + final List circles3 = + await viewController.addCircles([options]); + expect(circles3.length, 1); + expect(circles3[0]!.circleId, 'Circle_2'); + + getCircles = await viewController.getCircles(); + expect(getCircles.length, 3); + expect(getCircles[0]!.circleId, 'Circle_0'); + expect(getCircles[1]!.circleId, 'Circle_1'); + expect(getCircles[2]!.circleId, 'Circle_2'); + + /// Test removing the first circle. + await viewController.removeCircles([getCircles.first!]); + + getCircles = await viewController.getCircles(); + expect(getCircles.length, 2); + expect(getCircles[0]!.circleId, 'Circle_1'); + expect(getCircles[1]!.circleId, 'Circle_2'); + + /// Test removing the last circle. + await viewController.removeCircles([getCircles.last!]); + + getCircles = await viewController.getCircles(); + expect(getCircles.length, 1); + expect(getCircles[0]!.circleId, 'Circle_1'); + + /// Add multiple circles to test clearCircles(). + final List circles4 = await viewController + .addCircles([updatedOptions, options, options]); + + expect(circles4.length, 3); + expect(circles4[0]!.circleId, 'Circle_3'); + expect(circles4[1]!.circleId, 'Circle_4'); + expect(circles4[2]!.circleId, 'Circle_5'); + + getCircles = await viewController.getCircles(); + expect(getCircles.length, 4); + expect(getCircles[0]!.circleId, 'Circle_1'); + expect(getCircles[1]!.circleId, 'Circle_3'); + expect(getCircles[2]!.circleId, 'Circle_4'); + expect(getCircles[3]!.circleId, 'Circle_5'); + + /// Test clearCircles(). + await viewController.clearCircles(); + getCircles = await viewController.getCircles(); + expect(getCircles, isEmpty); + + /// Add circles to test clear(). + final List circles5 = + await viewController.addCircles([ + updatedOptions, + options, + options, + updatedOptions, + options, + ]); + + expect(circles5.length, 5); + + getCircles = await viewController.getCircles(); + expect(getCircles.length, 5); + + /// Test clear() removes all circles. + await viewController.clear(); + + getCircles = await viewController.getCircles(); + expect(getCircles, isEmpty); + + /// Test CircleNotFoundException error on removeCircles(). + try { + await viewController.removeCircles([updatedCircle]); + fail('Expected PlatformException'); + } on CircleNotFoundException catch (e) { + expect(e, isNotNull); + } + }); + } } diff --git a/example/lib/main.dart b/example/lib/main.dart index 9c9a249..2d16c99 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -27,7 +27,7 @@ import 'widgets/widgets.dart'; /// The list of pages to show in the Google Maps Navigation demo. final List _allPages = [ const NavigationPage(), - const MapPage(), + const BasicMapPage(), const CameraPage(), const MarkersPage(), const PolygonsPage(), diff --git a/example/lib/pages/map.dart b/example/lib/pages/map.dart index 19b06de..327d9ea 100644 --- a/example/lib/pages/map.dart +++ b/example/lib/pages/map.dart @@ -23,16 +23,22 @@ import 'package:google_navigation_flutter/google_navigation_flutter.dart'; import '../utils/utils.dart'; import '../widgets/widgets.dart'; -class MapPage extends ExamplePage { - const MapPage({super.key}) - : super(leading: const Icon(Icons.map), title: 'Map'); +/// A page to demonstrate the basic classic Google Map without navigation features. +/// +/// All features used in this example are available as well with [GoogleMapsNavigationView]. +/// Uses [GoogleMapView] to display a standard map view. +class BasicMapPage extends ExamplePage { + /// Constructs a [BasicMapPage]. + const BasicMapPage({super.key}) + : super( + leading: const Icon(Icons.map), title: 'Basic Google Map Controls'); @override - ExamplePageState createState() => _MapPageState(); + ExamplePageState createState() => _MapPageState(); } -class _MapPageState extends ExamplePageState { - late final GoogleNavigationViewController _navigationViewController; +class _MapPageState extends ExamplePageState { + late final GoogleMapViewController _mapViewController; late bool isMyLocationEnabled = false; late bool isMyLocationButtonEnabled = true; late bool consumeMyLocationButtonClickEvent = false; @@ -48,29 +54,29 @@ class _MapPageState extends ExamplePageState { Future setMapType(MapType type) async { mapType = type; - await _navigationViewController.setMapType(mapType: type); + await _mapViewController.setMapType(mapType: type); setState(() {}); } Future setMapStyleDefault() async { - await _navigationViewController.setMapStyle(null); + await _mapViewController.setMapStyle(null); } Future setMapStyleNight() async { final String jsonString = await rootBundle.loadString('assets/night_style.json'); - await _navigationViewController.setMapStyle(jsonString); + await _mapViewController.setMapStyle(jsonString); } Future setMapStyleSepia() async { final String jsonString = await rootBundle.loadString('assets/sepia_style.json'); - await _navigationViewController.setMapStyle(jsonString); + await _mapViewController.setMapStyle(jsonString); } // ignore: use_setters_to_change_properties - Future _onViewCreated(GoogleNavigationViewController controller) async { - _navigationViewController = controller; + Future _onViewCreated(GoogleMapViewController controller) async { + _mapViewController = controller; setState(() {}); } @@ -100,12 +106,10 @@ class _MapPageState extends ExamplePageState { context, (BuildContext context) => Stack( children: [ - GoogleMapsNavigationView( + GoogleMapsMapView( onViewCreated: _onViewCreated, onMyLocationClicked: _onMyLocationClicked, onMyLocationButtonClicked: _onMyLocationButtonClicked, - initialNavigationUIEnabledPreference: - NavigationUIEnabledPreference.disabled, ), Padding( padding: @@ -178,10 +182,9 @@ class _MapPageState extends ExamplePageState { return Column(children: [ SwitchListTile( onChanged: (bool newValue) async { - await _navigationViewController.settings - .setCompassEnabled(newValue); + await _mapViewController.settings.setCompassEnabled(newValue); final bool enabled = - await _navigationViewController.settings.isCompassEnabled(); + await _mapViewController.settings.isCompassEnabled(); setState(() { isCompassEnabled = enabled; }); @@ -193,9 +196,8 @@ class _MapPageState extends ExamplePageState { value: isMyLocationEnabled, controlAffinity: ListTileControlAffinity.leading, onChanged: (bool newValue) async { - await _navigationViewController.setMyLocationEnabled(newValue); - final bool enabled = - await _navigationViewController.isMyLocationEnabled(); + await _mapViewController.setMyLocationEnabled(newValue); + final bool enabled = await _mapViewController.isMyLocationEnabled(); setState(() { isMyLocationEnabled = enabled; }); @@ -207,9 +209,9 @@ class _MapPageState extends ExamplePageState { controlAffinity: ListTileControlAffinity.leading, onChanged: isMyLocationEnabled ? (bool newValue) async { - await _navigationViewController.settings + await _mapViewController.settings .setMyLocationButtonEnabled(newValue); - final bool enabled = await _navigationViewController.settings + final bool enabled = await _mapViewController.settings .isMyLocationButtonEnabled(); setState(() { isMyLocationButtonEnabled = enabled; @@ -223,9 +225,9 @@ class _MapPageState extends ExamplePageState { controlAffinity: ListTileControlAffinity.leading, onChanged: isMyLocationEnabled && isMyLocationButtonEnabled ? (bool newValue) async { - await _navigationViewController.settings + await _mapViewController.settings .setConsumeMyLocationButtonClickEventsEnabled(newValue); - final bool enabled = await _navigationViewController.settings + final bool enabled = await _mapViewController.settings .isConsumeMyLocationButtonClickEventsEnabled(); setState(() { consumeMyLocationButtonClickEvent = enabled; @@ -235,10 +237,9 @@ class _MapPageState extends ExamplePageState { visualDensity: VisualDensity.compact), SwitchListTile( onChanged: (bool newValue) async { - await _navigationViewController.settings - .setZoomGesturesEnabled(newValue); - final bool enabled = await _navigationViewController.settings - .isZoomGesturesEnabled(); + await _mapViewController.settings.setZoomGesturesEnabled(newValue); + final bool enabled = + await _mapViewController.settings.isZoomGesturesEnabled(); setState(() { isZoomGesturesEnabled = enabled; }); @@ -248,10 +249,10 @@ class _MapPageState extends ExamplePageState { if (Platform.isAndroid) SwitchListTile( onChanged: (bool newValue) async { - await _navigationViewController.settings + await _mapViewController.settings .setZoomControlsEnabled(newValue); - final bool enabled = await _navigationViewController.settings - .isZoomControlsEnabled(); + final bool enabled = + await _mapViewController.settings.isZoomControlsEnabled(); setState(() { isZoomControlsEnabled = enabled; }); @@ -260,10 +261,10 @@ class _MapPageState extends ExamplePageState { value: isZoomControlsEnabled), SwitchListTile( onChanged: (bool newValue) async { - await _navigationViewController.settings + await _mapViewController.settings .setRotateGesturesEnabled(newValue); - final bool enabled = await _navigationViewController.settings - .isRotateGesturesEnabled(); + final bool enabled = + await _mapViewController.settings.isRotateGesturesEnabled(); setState(() { isRotateGesturesEnabled = enabled; }); @@ -272,10 +273,10 @@ class _MapPageState extends ExamplePageState { value: isRotateGesturesEnabled), SwitchListTile( onChanged: (bool newValue) async { - await _navigationViewController.settings + await _mapViewController.settings .setScrollGesturesEnabled(newValue); - final bool enabled = await _navigationViewController.settings - .isScrollGesturesEnabled(); + final bool enabled = + await _mapViewController.settings.isScrollGesturesEnabled(); setState(() { isScrollGesturesEnabled = enabled; }); @@ -284,9 +285,9 @@ class _MapPageState extends ExamplePageState { value: isScrollGesturesEnabled), SwitchListTile( onChanged: (bool newValue) async { - await _navigationViewController.settings + await _mapViewController.settings .setScrollGesturesDuringRotateOrZoomEnabled(newValue); - final bool enabled = await _navigationViewController.settings + final bool enabled = await _mapViewController.settings .isScrollGesturesEnabledDuringRotateOrZoom(); setState(() { isScrollGesturesEnabledDuringRotateOrZoom = enabled; @@ -296,10 +297,9 @@ class _MapPageState extends ExamplePageState { value: isScrollGesturesEnabledDuringRotateOrZoom), SwitchListTile( onChanged: (bool newValue) async { - await _navigationViewController.settings - .setTiltGesturesEnabled(newValue); - final bool enabled = await _navigationViewController.settings - .isTiltGesturesEnabled(); + await _mapViewController.settings.setTiltGesturesEnabled(newValue); + final bool enabled = + await _mapViewController.settings.isTiltGesturesEnabled(); setState(() { isTiltGesturesEnabled = enabled; }); @@ -308,10 +308,9 @@ class _MapPageState extends ExamplePageState { value: isTiltGesturesEnabled), SwitchListTile( onChanged: (bool newValue) async { - await _navigationViewController.settings - .setTrafficEnabled(newValue); + await _mapViewController.settings.setTrafficEnabled(newValue); final bool enabled = - await _navigationViewController.settings.isTrafficEnabled(); + await _mapViewController.settings.isTrafficEnabled(); setState(() { isTrafficEnabled = enabled; }); diff --git a/example/lib/pages/multiple_views.dart b/example/lib/pages/multiple_views.dart index 3e5da71..02ac076 100644 --- a/example/lib/pages/multiple_views.dart +++ b/example/lib/pages/multiple_views.dart @@ -14,9 +14,13 @@ // ignore_for_file: public_member_api_docs, unused_field, use_setters_to_change_properties +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:google_navigation_flutter/google_navigation_flutter.dart'; import '../widgets/widgets.dart'; +import '../utils/utils.dart'; +import 'navigation.dart'; class MultipleMapViewsPage extends ExamplePage { const MultipleMapViewsPage({super.key}) @@ -39,24 +43,172 @@ class _MultiplexState extends ExamplePageState { // Counter to keep track of the number of camera moves to alternate between the two cameras. int _cameraMoveCounter = 0; - GoogleNavigationViewController? _firstNavigationController; - GoogleNavigationViewController? _secondNavigationController; + bool _termsAndConditionsAccepted = false; + bool _locationPermissionsAccepted = false; + bool _navigatorInitialized = false; + bool _guidanceRunning = false; + bool _validRoute = false; + + final List _waypoints = []; + int _nextWaypointIndex = 0; + + SimulationState _simulationState = SimulationState.notRunning; + + /// Camera location used to initialize the map view on simulator if location + /// is not available by the given timeout [_userLocationTimeoutMS]. + static const LatLng cameraLocationMIT = + LatLng(latitude: 42.3601, longitude: -71.094013); + static const int _userLocationTimeoutMS = 1500; + + /// Latest user location received from the navigator. + LatLng? _userLocation; + + /// Used to track if navigator has been initialized at least once. + /// In this example app navigator can be cleaned up and re-initialized. + /// This variable is used to make sure that navigator is initialized before + /// showing the navigation view. + bool _navigatorInitializedAtLeastOnce = false; + + GoogleMapViewController? _mapController; + GoogleNavigationViewController? _navigationController; + + @override + void initState() { + super.initState(); + unawaited(_initialize()); + } + + @override + void dispose() { + GoogleMapsNavigator.cleanup(); + clearRegisteredImages(); + super.dispose(); + } + + Future _initialize() async { + // Check if terms and conditions have been accepted and show dialog if not. + await _showTermsAndConditionsDialogIfNeeded(); + + // Check if location permissions have been accepted and show dialog if not. + await _askLocationPermissionsIfNeeded(); + + // Initilize navigator if terms and conditions and location permissions + // have been accepted. + if (_termsAndConditionsAccepted && _locationPermissionsAccepted) { + await _initializeNavigator(); + } + } + + Future _initializeNavigator() async { + assert(_termsAndConditionsAccepted, 'Terms must be accepted'); + assert( + _locationPermissionsAccepted, 'Location permissions must be granted'); + + if (!_navigatorInitialized) { + debugPrint('Initializing new navigation session...'); + await GoogleMapsNavigator.initializeNavigationSession(); + //await _setupListeners(); + await _updateNavigatorInitializationState(); + await _restorePossibleNavigatorState(); + unawaited(_setDefaultUserLocationAfterDelay()); + debugPrint('Navigator has been initialized: $_navigatorInitialized'); + } + setState(() {}); + } + + /// iOS emulator does not update location and does not fire roadsnapping + /// events. Initialize user location to [cameraLocationMIT] if user + /// location is not available after timeout. + Future _setDefaultUserLocationAfterDelay() async { + Future.delayed(const Duration(milliseconds: _userLocationTimeoutMS), + () async { + if (mounted && _userLocation == null) { + _userLocation = + await _navigationController?.getMyLocation() ?? cameraLocationMIT; + if (mounted) { + setState(() {}); + } + } + }); + } + + // Navigator state is not persisted between app restarts, so we need to check + // if there is a valid route and guidance running, and restore the state. + Future _restorePossibleNavigatorState() async { + if (_navigatorInitialized) { + final List waypoints = await _getWaypoints(); + + // Restore local waypoint index + if (waypoints.isNotEmpty) { + final List parts = waypoints.last.title.split(' '); + if (parts.length == 2) { + _nextWaypointIndex = int.tryParse(parts.last) ?? 0; + } + + _validRoute = true; + _waypoints.clear(); + _waypoints.addAll(waypoints); + } + + _guidanceRunning = await GoogleMapsNavigator.isGuidanceRunning(); + if (_guidanceRunning) { + // Guidance is running, but there is currently no way to check if + // simulation is running as well, so we set it's state as unknown. + _simulationState = SimulationState.unknown; + } - void _onViewCreated(GoogleNavigationViewController controller) { - _firstNavigationController = controller; + setState(() {}); + } } - void _onViewCreated2(GoogleNavigationViewController controller) { - _secondNavigationController = controller; + // Helper function to update local waypoint data from the navigation session. + Future> _getWaypoints() async { + assert(_navigatorInitialized); + final List routeSegments = + await GoogleMapsNavigator.getRouteSegments(); + return routeSegments + .where((RouteSegment e) => e.destinationWaypoint != null) + .map((RouteSegment e) => e.destinationWaypoint!) + .toList(); + } + + Future _updateNavigatorInitializationState() async { + _navigatorInitialized = await GoogleMapsNavigator.isInitialized(); + if (_navigatorInitialized) { + _navigatorInitializedAtLeastOnce = true; + } + setState(() {}); + } + + Future _showTermsAndConditionsDialogIfNeeded() async { + _termsAndConditionsAccepted = await requestTermsAndConditionsAcceptance(); + setState(() {}); + } + + Future _askLocationPermissionsIfNeeded() async { + _locationPermissionsAccepted = await requestLocationDialogAcceptance(); + setState(() {}); + } + + void _onViewCreated(GoogleMapViewController controller) { + setState(() { + _mapController = controller; + }); + } + + Future _onViewCreated2( + GoogleNavigationViewController controller) async { + setState(() { + _navigationController = controller; + }); + await controller.setMyLocationEnabled(true); } Future _moveCameras() async { - await _firstNavigationController!.moveCamera(CameraUpdate.newCameraPosition( + await _mapController!.moveCamera(CameraUpdate.newCameraPosition( _cameraMoveCounter.isEven ? cameraPositionOxford : cameraPositionMIT)); - await _secondNavigationController!.moveCamera( - CameraUpdate.newCameraPosition(_cameraMoveCounter.isOdd - ? cameraPositionOxford - : cameraPositionMIT)); + await _navigationController!.moveCamera(CameraUpdate.newCameraPosition( + _cameraMoveCounter.isOdd ? cameraPositionOxford : cameraPositionMIT)); setState(() { _cameraMoveCounter += 1; }); @@ -72,22 +224,41 @@ class _MultiplexState extends ExamplePageState { children: [ SizedBox( height: 200, - child: GoogleMapsNavigationView( + child: GoogleMapsMapView( onViewCreated: _onViewCreated, ), ), const SizedBox(height: 20), SizedBox( height: 200, - child: GoogleMapsNavigationView( - onViewCreated: _onViewCreated2, - ), + child: _navigatorInitializedAtLeastOnce && + _userLocation != null + ? GoogleMapsNavigationView( + onViewCreated: _onViewCreated2, + initialCameraPosition: CameraPosition( + // Initialize map to user location. + target: _userLocation!, + zoom: 15, + ), + ) + : const Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text('Waiting navigator and user location'), + SizedBox(height: 10), + SizedBox( + width: 30, + height: 30, + child: CircularProgressIndicator()) + ], + ), + ), ), const SizedBox( height: 50, ), - if (_firstNavigationController != null && - _secondNavigationController != null) + if (_mapController != null && _navigationController != null) ElevatedButton( onPressed: _moveCameras, child: const Text('Move cameras'), diff --git a/ios/Classes/Convert+MapConfiguration.swift b/ios/Classes/Convert+MapConfiguration.swift index 3c18c6d..c2659b7 100644 --- a/ios/Classes/Convert+MapConfiguration.swift +++ b/ios/Classes/Convert+MapConfiguration.swift @@ -16,13 +16,15 @@ import Foundation import GoogleMaps extension Convert { - static func convertNavigationUIEnabledPreference(preference: NavigationUIEnabledPreferenceDto) + static func convertNavigationUIEnabledPreference(preference: NavigationUIEnabledPreferenceDto?) -> NavigationUIEnabledPreference { switch preference { case .automatic: return .automatic case .disabled: return .disabled + default: + return .disabled } } diff --git a/ios/Classes/GoogleMapsNavigationPlugin.swift b/ios/Classes/GoogleMapsNavigationPlugin.swift index 624cafd..4b05f48 100644 --- a/ios/Classes/GoogleMapsNavigationPlugin.swift +++ b/ios/Classes/GoogleMapsNavigationPlugin.swift @@ -20,7 +20,7 @@ extension FlutterError: Error {} public class GoogleMapsNavigationPlugin: NSObject, FlutterPlugin { private static var viewRegistry: GoogleMapsNavigationViewRegistry? private static var viewMessageHandler: GoogleMapsNavigationViewMessageHandler? - private static var navigationViewEventApi: NavigationViewEventApi? + private static var viewEventApi: ViewEventApi? private static var navigationInspector: NavigationInspector? private static var sessionMessageHandler: GoogleMapsNavigationSessionMessageHandler? @@ -38,18 +38,18 @@ public class GoogleMapsNavigationPlugin: NSObject, FlutterPlugin { return } viewMessageHandler = GoogleMapsNavigationViewMessageHandler(viewRegistry: viewRegistry!) - NavigationViewApiSetup.setUp( + MapViewApiSetup.setUp( binaryMessenger: registrar.messenger(), api: viewMessageHandler ) - navigationViewEventApi = NavigationViewEventApi(binaryMessenger: registrar.messenger()) - guard navigationViewEventApi != nil else { + viewEventApi = ViewEventApi(binaryMessenger: registrar.messenger()) + guard viewEventApi != nil else { return } imageRegistry = ImageRegistry() let factory = GoogleMapsNavigationViewFactory( viewRegistry: viewRegistry!, - navigationViewEventApi: navigationViewEventApi!, + viewEventApi: viewEventApi!, imageRegistry: imageRegistry! ) registrar.register(factory, withId: "google_navigation_flutter") diff --git a/ios/Classes/GoogleMapsNavigationSessionManager.swift b/ios/Classes/GoogleMapsNavigationSessionManager.swift index 1eaf620..5f85d75 100644 --- a/ios/Classes/GoogleMapsNavigationSessionManager.swift +++ b/ios/Classes/GoogleMapsNavigationSessionManager.swift @@ -136,7 +136,7 @@ class GoogleMapsNavigationSessionManager: NSObject { _session?.roadSnappedLocationProvider?.add(self) // Attach navigation session to all existing maps views. - try _viewRegistry?.getAllRegisteredViewIds().forEach { id in + try _viewRegistry?.getAllRegisteredNavigationViewIds().forEach { id in try attachNavigationSessionToMapView(mapId: id) } } diff --git a/ios/Classes/GoogleMapsNavigationView.swift b/ios/Classes/GoogleMapsNavigationView.swift index 8d00c1b..4762077 100644 --- a/ios/Classes/GoogleMapsNavigationView.swift +++ b/ios/Classes/GoogleMapsNavigationView.swift @@ -29,10 +29,11 @@ enum GoogleMapsNavigationViewError: Error { } class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelegate { - private var _navigationView: ViewStateAwareGMSMapView! + private var _mapView: ViewStateAwareGMSMapView! private var _viewRegistry: GoogleMapsNavigationViewRegistry - private var _navigationViewEventApi: NavigationViewEventApi + private var _viewEventApi: ViewEventApi private var _viewId: Int64 + private var _isNavigationView: Bool private var _myLocationButton: Bool = true private var _markerControllers: [MarkerController] = [] private var _gmsPolygons: [GMSPolygon] = [] @@ -49,25 +50,27 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega var isAttachedToSession: Bool = false func view() -> UIView { - _navigationView + _mapView } init(frame: CGRect, viewIdentifier viewId: Int64, + isNavigationView: Bool, viewRegistry registry: GoogleMapsNavigationViewRegistry, - navigationViewEventApi: NavigationViewEventApi, + viewEventApi: ViewEventApi, navigationUIEnabledPreference: NavigationUIEnabledPreference, mapConfiguration: MapConfiguration, imageRegistry: ImageRegistry) { _viewId = viewId + _isNavigationView = isNavigationView _viewRegistry = registry - _navigationViewEventApi = navigationViewEventApi + _viewEventApi = viewEventApi _mapConfiguration = mapConfiguration _imageRegistry = imageRegistry let mapViewOptions = GMSMapViewOptions() _mapConfiguration.apply(to: mapViewOptions, withFrame: frame) - _navigationView = ViewStateAwareGMSMapView(options: mapViewOptions) - _mapConfiguration.apply(to: _navigationView) + _mapView = ViewStateAwareGMSMapView(options: mapViewOptions) + _mapConfiguration.apply(to: _mapView) super.init() @@ -75,26 +78,31 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega applyNavigationUIEnabledPreference() registry.registerView(viewId: viewId, view: self) - _navigationView.delegate = self - _navigationView.viewSettledDelegate = self + _mapView.delegate = self + _mapView.viewSettledDelegate = self } deinit { _viewRegistry.unregisterView(viewId: _viewId) - _navigationView.delegate = nil + _mapView.delegate = nil } - func onViewSettled(_ view: UIView) { - _mapConfiguration.applyCameraPosition(to: _navigationView) + func isNavigationView() -> Bool { + _isNavigationView + } - // Attach possible navigation session to map. - GoogleMapsNavigationSessionManager.shared.attachNavigationSessionToMapView( - mapView: self - ) + func onViewSettled(_ view: UIView) { + _mapConfiguration.applyCameraPosition(to: _mapView) - applyNavigationUIEnabledPreference() + // Attach possible navigation session to map if map is navigation view. + if _isNavigationView { + GoogleMapsNavigationSessionManager.shared.attachNavigationSessionToMapView( + mapView: self + ) + applyNavigationUIEnabledPreference() + } - _navigationView.needsUpdateConstraints() + _mapView.needsUpdateConstraints() // Inform the flutter implementation that view is ready to be controlled. _mapViewReady = true @@ -128,7 +136,7 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega } func isMyLocationEnabled() throws -> Bool { - _navigationView.isMyLocationEnabled + _mapView.isMyLocationEnabled } private func findMarkerController(markerId: String) throws -> MarkerController { @@ -174,21 +182,21 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega } func setMyLocationEnabled(_ enabled: Bool) throws { - _navigationView.isMyLocationEnabled = enabled + _mapView.isMyLocationEnabled = enabled try updateMyLocationButton() } func getMapType() -> GMSMapViewType { - _navigationView.mapType + _mapView.mapType } func setMapType(mapType: GMSMapViewType) throws { - _navigationView.mapType = mapType + _mapView.mapType = mapType } func setMapStyle(styleJson: String) throws { do { - _navigationView.mapStyle = try GMSMapStyle(jsonString: styleJson) + _mapView.mapStyle = try GMSMapStyle(jsonString: styleJson) } catch { throw GoogleMapsNavigationViewError.mapStyleError } @@ -202,12 +210,12 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega func updateMyLocationButton() throws { // Align the behavior with Android: the default value of myLocationButton is true, // but it is not shown if my location is disabled. - _navigationView.settings.myLocationButton = _navigationView + _mapView.settings.myLocationButton = _mapView .isMyLocationEnabled && _myLocationButton } func setZoomGesturesEnabled(_ enabled: Bool) throws { - _navigationView.settings.zoomGestures = enabled + _mapView.settings.zoomGestures = enabled } func setZoomControlsEnabled(_ enabled: Bool) throws { @@ -215,23 +223,23 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega } func setCompassEnabled(_ enabled: Bool) throws { - _navigationView.settings.compassButton = enabled + _mapView.settings.compassButton = enabled } func setRotateGesturesEnabled(_ enabled: Bool) throws { - _navigationView.settings.rotateGestures = enabled + _mapView.settings.rotateGestures = enabled } func setScrollGesturesEnabled(_ enabled: Bool) throws { - _navigationView.settings.scrollGestures = enabled + _mapView.settings.scrollGestures = enabled } func setScrollGesturesDuringRotateOrZoomEnabled(_ enabled: Bool) throws { - _navigationView.settings.allowScrollGesturesDuringRotateOrZoom = enabled + _mapView.settings.allowScrollGesturesDuringRotateOrZoom = enabled } func setTiltGesturesEnabled(_ enabled: Bool) throws { - _navigationView.settings.tiltGestures = enabled + _mapView.settings.tiltGestures = enabled } func setMapToolbarEnabled(_ enabled: Bool) throws { @@ -239,7 +247,7 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega } func setTrafficEnabled(_ enabled: Bool) throws { - _navigationView.isTrafficEnabled = enabled + _mapView.isTrafficEnabled = enabled } func isMyLocationButtonEnabled() -> Bool { @@ -247,7 +255,7 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega } func isZoomGesturesEnabled() -> Bool { - _navigationView.settings.zoomGestures + _mapView.settings.zoomGestures } func isZoomControlsEnabled() throws -> Bool { @@ -255,23 +263,23 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega } func isCompassEnabled() -> Bool { - _navigationView.settings.compassButton + _mapView.settings.compassButton } func isRotateGesturesEnabled() -> Bool { - _navigationView.settings.rotateGestures + _mapView.settings.rotateGestures } func isScrollGesturesEnabled() -> Bool { - _navigationView.settings.scrollGestures + _mapView.settings.scrollGestures } func isScrollGesturesEnabledDuringRotateOrZoom() -> Bool { - _navigationView.settings.allowScrollGesturesDuringRotateOrZoom + _mapView.settings.allowScrollGesturesDuringRotateOrZoom } func isTiltGesturesEnabled() -> Bool { - _navigationView.settings.tiltGestures + _mapView.settings.tiltGestures } func isMapToolbarEnabled() throws -> Bool { @@ -279,15 +287,15 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega } func isTrafficEnabled() -> Bool { - _navigationView.isTrafficEnabled + _mapView.isTrafficEnabled } func showRouteOverview() { - _navigationView.cameraMode = .overview + _mapView.cameraMode = .overview } func getMyLocation() -> CLLocationCoordinate2D? { - if let location = _navigationView.myLocation { + if let location = _mapView.myLocation { return location.coordinate } else { return nil @@ -295,82 +303,82 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega } func getCameraPosition() -> GMSCameraPosition { - _navigationView.camera + _mapView.camera } func getVisibleRegion() -> GMSCoordinateBounds { - GMSCoordinateBounds(region: _navigationView.projection.visibleRegion()) + GMSCoordinateBounds(region: _mapView.projection.visibleRegion()) } func animateCameraToCameraPosition(cameraPosition: GMSCameraPosition) { - _navigationView.animate(with: GMSCameraUpdate.setCamera(cameraPosition)) + _mapView.animate(with: GMSCameraUpdate.setCamera(cameraPosition)) } func animateCameraToLatLng(point: CLLocationCoordinate2D) { - _navigationView.animate(with: GMSCameraUpdate.setTarget(point)) + _mapView.animate(with: GMSCameraUpdate.setTarget(point)) } func animateCameraToLatLngBounds(bounds: GMSCoordinateBounds, padding: Double) { - _navigationView.animate(with: GMSCameraUpdate.fit(bounds, withPadding: padding)) + _mapView.animate(with: GMSCameraUpdate.fit(bounds, withPadding: padding)) } func animateCameraToLatLngZoom(point: CLLocationCoordinate2D, zoom: Double) { - _navigationView.animate(with: GMSCameraUpdate.setTarget(point, zoom: Float(zoom))) + _mapView.animate(with: GMSCameraUpdate.setTarget(point, zoom: Float(zoom))) } func animateCameraByScroll(dx: Double, dy: Double) { - _navigationView.animate(with: GMSCameraUpdate.scrollBy(x: CGFloat(dx), y: CGFloat(dy))) + _mapView.animate(with: GMSCameraUpdate.scrollBy(x: CGFloat(dx), y: CGFloat(dy))) } func animateCameraByZoom(zoomBy: Double, focus: CGPoint?) { if focus != nil { - _navigationView.animate(with: GMSCameraUpdate.zoom(by: Float(zoomBy), at: focus!)) + _mapView.animate(with: GMSCameraUpdate.zoom(by: Float(zoomBy), at: focus!)) } else { - _navigationView.animate(with: GMSCameraUpdate.zoom(by: Float(zoomBy))) + _mapView.animate(with: GMSCameraUpdate.zoom(by: Float(zoomBy))) } } func animateCameraToZoom(zoom: Double) { - _navigationView.animate(with: GMSCameraUpdate.zoom(to: Float(zoom))) + _mapView.animate(with: GMSCameraUpdate.zoom(to: Float(zoom))) } func moveCameraToCameraPosition(cameraPosition: GMSCameraPosition) { - _navigationView.moveCamera(GMSCameraUpdate.setCamera(cameraPosition)) + _mapView.moveCamera(GMSCameraUpdate.setCamera(cameraPosition)) } func moveCameraToLatLng(point: CLLocationCoordinate2D) { - _navigationView.moveCamera(GMSCameraUpdate.setTarget(point)) + _mapView.moveCamera(GMSCameraUpdate.setTarget(point)) } func moveCameraToLatLngBounds(bounds: GMSCoordinateBounds, padding: Double) { - _navigationView.moveCamera(GMSCameraUpdate.fit(bounds, withPadding: padding)) + _mapView.moveCamera(GMSCameraUpdate.fit(bounds, withPadding: padding)) } func moveCameraToLatLngZoom(point: CLLocationCoordinate2D, zoom: Double) { - _navigationView.moveCamera(GMSCameraUpdate.setTarget(point, zoom: Float(zoom))) + _mapView.moveCamera(GMSCameraUpdate.setTarget(point, zoom: Float(zoom))) } func moveCameraByScroll(dx: Double, dy: Double) { - _navigationView.moveCamera(GMSCameraUpdate.scrollBy(x: CGFloat(dx), y: CGFloat(dy))) + _mapView.moveCamera(GMSCameraUpdate.scrollBy(x: CGFloat(dx), y: CGFloat(dy))) } func moveCameraByZoom(zoomBy: Double, focus: CGPoint?) { if focus != nil { - _navigationView.moveCamera(GMSCameraUpdate.zoom(by: Float(zoomBy), at: focus!)) + _mapView.moveCamera(GMSCameraUpdate.zoom(by: Float(zoomBy), at: focus!)) } else { - _navigationView.moveCamera(GMSCameraUpdate.zoom(by: Float(zoomBy))) + _mapView.moveCamera(GMSCameraUpdate.zoom(by: Float(zoomBy))) } } func moveCameraToZoom(zoom: Double) { - _navigationView.moveCamera(GMSCameraUpdate.zoom(to: Float(zoom))) + _mapView.moveCamera(GMSCameraUpdate.zoom(to: Float(zoom))) } func followMyLocation(perspective: GMSNavigationCameraPerspective, zoomLevel: Double?) { - _navigationView.followingPerspective = perspective - _navigationView.cameraMode = .following + _mapView.followingPerspective = perspective + _mapView.cameraMode = .following if zoomLevel != nil { - _navigationView.followingZoomLevel = Float(zoomLevel!) + _mapView.followingZoomLevel = Float(zoomLevel!) } } @@ -379,105 +387,110 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega // Navigation UI delegate needs to be set after attaching // the session to the map view. - let navigationWasEnabled = _navigationView.isNavigationEnabled + if !_isNavigationView { + // Navigation session cannot be attached to view that is not initialized as navigation view. + return false + } + + let navigationWasEnabled = _mapView.isNavigationEnabled - let result = _navigationView.enableNavigation(with: session) + let result = _mapView.enableNavigation(with: session) - if navigationWasEnabled != _navigationView.isNavigationEnabled { + if navigationWasEnabled != _mapView.isNavigationEnabled { // Navigation UI got enabled, send enabled change event. - _navigationViewEventApi + _viewEventApi .onNavigationUIEnabledChanged( viewId: _viewId, - navigationUIEnabled: _navigationView.isNavigationEnabled + navigationUIEnabled: _mapView.isNavigationEnabled ) { _ in } } - _navigationView.navigationUIDelegate = self + _mapView.navigationUIDelegate = self isAttachedToSession = true return result } func showDestinationMarkers(show: Bool) { - _navigationView.settings.showsDestinationMarkers = show + _mapView.settings.showsDestinationMarkers = show } func showTrafficLights(show: Bool) { - _navigationView.settings.showsTrafficLights = show + _mapView.settings.showsTrafficLights = show } func showStopSigns(show: Bool) { - _navigationView.settings.showsStopSigns = show + _mapView.settings.showsStopSigns = show } func isNavigationTripProgressBarEnabled() throws -> Bool { - _navigationView.settings.isNavigationTripProgressBarEnabled + _mapView.settings.isNavigationTripProgressBarEnabled } func setNavigationTripProgressBarEnabled(_ enabled: Bool) { - _navigationView.settings.isNavigationTripProgressBarEnabled = enabled + _mapView.settings.isNavigationTripProgressBarEnabled = enabled } func isNavigationHeaderEnabled() -> Bool { - _navigationView.settings.isNavigationHeaderEnabled + _mapView.settings.isNavigationHeaderEnabled } func setNavigationHeaderEnabled(_ enabled: Bool) { - _navigationView.settings.isNavigationHeaderEnabled = enabled + _mapView.settings.isNavigationHeaderEnabled = enabled } func isNavigationFooterEnabled() -> Bool { - _navigationView.settings.isNavigationFooterEnabled + _mapView.settings.isNavigationFooterEnabled } func setNavigationFooterEnabled(_ enabled: Bool) { - _navigationView.settings.isNavigationFooterEnabled = enabled + _mapView.settings.isNavigationFooterEnabled = enabled } func isRecenterButtonEnabled() -> Bool { - _navigationView.settings.isRecenterButtonEnabled + _mapView.settings.isRecenterButtonEnabled } func setRecenterButtonEnabled(_ enabled: Bool) { - _navigationView.settings.isRecenterButtonEnabled = enabled + _mapView.settings.isRecenterButtonEnabled = enabled } func isSpeedLimitIconEnabled() -> Bool { - _navigationView.shouldDisplaySpeedLimit + _mapView.shouldDisplaySpeedLimit } func setSpeedLimitIconEnabled(_ enabled: Bool) { - _navigationView.shouldDisplaySpeedLimit = enabled + _mapView.shouldDisplaySpeedLimit = enabled } func isSpeedometerEnabled() -> Bool { - _navigationView.shouldDisplaySpeedometer + _mapView.shouldDisplaySpeedometer } func setSpeedometerEnabled(_ enabled: Bool) { - _navigationView.shouldDisplaySpeedometer = enabled + _mapView.shouldDisplaySpeedometer = enabled } func isTrafficIncidentCardsEnabled() -> Bool { - _navigationView.settings.showsIncidentCards + _mapView.settings.showsIncidentCards } func setTrafficIncidentCardsEnabled(_ enabled: Bool) { - _navigationView.settings.showsIncidentCards = enabled + _mapView.settings.showsIncidentCards = enabled } func isNavigationUIEnabled() -> Bool { - _navigationView.isNavigationEnabled + _mapView.isNavigationEnabled } func setNavigationUIEnabled(_ enabled: Bool) { - if _navigationView.isNavigationEnabled != enabled { - _navigationView.isNavigationEnabled = enabled - _navigationViewEventApi + if _mapView.isNavigationEnabled != enabled { + _mapView.isNavigationEnabled = enabled + _viewEventApi .onNavigationUIEnabledChanged(viewId: _viewId, navigationUIEnabled: enabled) { _ in } if !enabled { - let camera = _navigationView.camera - _navigationView.animate(to: GMSCameraPosition( + let camera = _mapView.camera + _mapView.animate(to: GMSCameraPosition( target: camera.target, zoom: camera.zoom, bearing: 0.0, @@ -488,31 +501,31 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega } func getMinZoomPreference() -> Float { - _navigationView.minZoom + _mapView.minZoom } func getMaxZoomPreference() -> Float { - _navigationView.maxZoom + _mapView.maxZoom } func resetMinMaxZoomPreference() { - _navigationView.setMinZoom(kGMSMinZoomLevel, maxZoom: kGMSMaxZoomLevel) + _mapView.setMinZoom(kGMSMinZoomLevel, maxZoom: kGMSMaxZoomLevel) } func setMinZoomPreference(minZoomPreference: Float) throws { - if minZoomPreference > _navigationView.maxZoom { + if minZoomPreference > _mapView.maxZoom { throw GoogleMapsNavigationViewError.minZoomGreaterThanMaxZoom } - _navigationView.setMinZoom(minZoomPreference, maxZoom: _navigationView.maxZoom) + _mapView.setMinZoom(minZoomPreference, maxZoom: _mapView.maxZoom) } func setMaxZoomPreference(maxZoomPreference: Float) throws { - if maxZoomPreference < _navigationView.minZoom { + if maxZoomPreference < _mapView.minZoom { throw GoogleMapsNavigationViewError.maxZoomLessThanMinZoom } - _navigationView.setMinZoom(_navigationView.minZoom, maxZoom: maxZoomPreference) + _mapView.setMinZoom(_mapView.minZoom, maxZoom: maxZoomPreference) } func getMarkers() -> [MarkerDto] { @@ -527,7 +540,7 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega markerController.update(from: marker, imageRegistry: _imageRegistry) // Handle visibility property on iOS by removing/not putting the marker // on the map. - markerController.gmsMarker.map = marker.isVisible() ? _navigationView : nil + markerController.gmsMarker.map = marker.isVisible() ? _mapView : nil _markerControllers.append(markerController) return marker } @@ -542,7 +555,7 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega markerController.update(from: updatedMarker, imageRegistry: _imageRegistry) // Handle visibility property on iOS by removing/not putting the marker // on the map. - markerController.gmsMarker.map = updatedMarker.isVisible() ? _navigationView : nil + markerController.gmsMarker.map = updatedMarker.isVisible() ? _mapView : nil return updatedMarker } return markers @@ -578,7 +591,7 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega gmsPolygon.setPolygonId(polygon.polygonId) // Handle visibility property on iOS by removing/not putting the polygon // on the map. - gmsPolygon.map = polygon.isVisible() ? _navigationView : nil + gmsPolygon.map = polygon.isVisible() ? _mapView : nil _gmsPolygons.append(gmsPolygon) return polygon } @@ -593,7 +606,7 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega gmsPolygon.update(from: pigeonPolygon) // Handle visibility property on iOS by removing/not putting the polygon // on the map. - gmsPolygon.map = pigeonPolygon.isVisible() ? _navigationView : nil + gmsPolygon.map = pigeonPolygon.isVisible() ? _mapView : nil return pigeonPolygon } return polygons @@ -629,7 +642,7 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega gmsPolyline.setPolylineId(polyline.polylineId) // Handle visibility property on iOS by removing/not putting the polyline // on the map. - gmsPolyline.map = polyline.isVisible() ? _navigationView : nil + gmsPolyline.map = polyline.isVisible() ? _mapView : nil _gmsPolylines.append(gmsPolyline) return polyline } @@ -644,7 +657,7 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega gmsPolyline.update(from: pigeonPolyline) // Handle visibility property on iOS by removing/not putting the polyline // on the map. - gmsPolyline.map = pigeonPolyline.isVisible() ? _navigationView : nil + gmsPolyline.map = pigeonPolyline.isVisible() ? _mapView : nil return pigeonPolyline } return polylines @@ -680,7 +693,7 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega gmsCircle.setCircleId(circle.circleId) // Handle visibility property on iOS by removing/not putting the circle // on the map. - gmsCircle.map = circle.isVisible() ? _navigationView : nil + gmsCircle.map = circle.isVisible() ? _mapView : nil _gmsCircles.append(gmsCircle) return circle } @@ -695,7 +708,7 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega gmsCircle.update(from: pigeonCircle) // Handle visibility property on iOS by removing/not putting the circle // on the map. - gmsCircle.map = pigeonCircle.isVisible() ? _navigationView : nil + gmsCircle.map = pigeonCircle.isVisible() ? _mapView : nil return pigeonCircle } return circles @@ -725,14 +738,14 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega _gmsPolylines.removeAll() _gmsPolygons.removeAll() _gmsCircles.removeAll() - _navigationView.clear() + _mapView.clear() } private func sendMarkerEvent(marker: GMSMarker, eventType: MarkerEventTypeDto) { do { let markerController = try findMarkerController(gmsMarker: marker) - _navigationViewEventApi.onMarkerEvent( + _viewEventApi.onMarkerEvent( viewId: _viewId, markerId: markerController.markerId, eventType: eventType, @@ -747,7 +760,7 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega eventType: MarkerDragEventTypeDto) { do { let markerController = try findMarkerController(gmsMarker: marker) - _navigationViewEventApi.onMarkerDragEvent( + _viewEventApi.onMarkerDragEvent( viewId: _viewId, markerId: markerController.markerId, eventType: eventType, @@ -780,13 +793,13 @@ class GoogleMapsNavigationView: NSObject, FlutterPlatformView, ViewSettledDelega extension GoogleMapsNavigationView: GMSMapViewNavigationUIDelegate { func mapViewDidTapRecenterButton(_ mapView: GMSMapView) { - _navigationViewEventApi.onRecenterButtonClicked(viewId: _viewId) { _ in } + _viewEventApi.onRecenterButtonClicked(viewId: _viewId) { _ in } } } extension GoogleMapsNavigationView: GMSMapViewDelegate { func mapView(_ mapView: GMSMapView, didTapAt coordinate: CLLocationCoordinate2D) { - _navigationViewEventApi.onMapClickEvent( + _viewEventApi.onMapClickEvent( viewId: _viewId, latLng: .init( latitude: coordinate.latitude, @@ -797,7 +810,7 @@ extension GoogleMapsNavigationView: GMSMapViewDelegate { } func mapView(_ mapView: GMSMapView, didLongPressAt coordinate: CLLocationCoordinate2D) { - _navigationViewEventApi.onMapLongClickEvent( + _viewEventApi.onMapLongClickEvent( viewId: _viewId, latLng: .init( latitude: coordinate.latitude, @@ -848,19 +861,19 @@ extension GoogleMapsNavigationView: GMSMapViewDelegate { func mapView(_ mapView: GMSMapView, didTap overlay: GMSOverlay) { if let polygon = overlay as? GMSPolygon { - _navigationViewEventApi.onPolygonClicked( + _viewEventApi.onPolygonClicked( viewId: _viewId, polygonId: polygon.getPolygonId(), completion: { _ in } ) } else if let polyline = overlay as? GMSPolyline { - _navigationViewEventApi.onPolylineClicked( + _viewEventApi.onPolylineClicked( viewId: _viewId, polylineId: polyline.getPolylineId(), completion: { _ in } ) } else if let circle = overlay as? GMSCircle { - _navigationViewEventApi.onCircleClicked( + _viewEventApi.onCircleClicked( viewId: _viewId, circleId: circle.getCircleId(), completion: { _ in } @@ -869,18 +882,18 @@ extension GoogleMapsNavigationView: GMSMapViewDelegate { } func mapView(_ mapView: GMSMapView, didTapMyLocation location: CLLocationCoordinate2D) { - _navigationViewEventApi.onMyLocationClicked(viewId: _viewId, completion: { _ in }) + _viewEventApi.onMyLocationClicked(viewId: _viewId, completion: { _ in }) } func didTapMyLocationButton(for mapView: GMSMapView) -> Bool { - _navigationViewEventApi.onMyLocationButtonClicked(viewId: _viewId, completion: { _ in }) + _viewEventApi.onMyLocationButtonClicked(viewId: _viewId, completion: { _ in }) return _consumeMyLocationButtonClickEventsEnabled } func mapView(_ mapView: GMSMapView, willMove gesture: Bool) { if _listenCameraChanges { let position = Convert.convertCameraPosition(position: mapView.camera) - _navigationViewEventApi.onCameraChanged( + _viewEventApi.onCameraChanged( viewId: _viewId, eventType: gesture ? .moveStartedByGesture : .moveStartedByApi, position: position, @@ -891,7 +904,7 @@ extension GoogleMapsNavigationView: GMSMapViewDelegate { func mapView(_ mapView: GMSMapView, idleAt position: GMSCameraPosition) { if _listenCameraChanges { - _navigationViewEventApi.onCameraChanged( + _viewEventApi.onCameraChanged( viewId: _viewId, eventType: .onCameraIdle, position: Convert.convertCameraPosition(position: position), @@ -902,7 +915,7 @@ extension GoogleMapsNavigationView: GMSMapViewDelegate { func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition) { if _listenCameraChanges { - _navigationViewEventApi.onCameraChanged( + _viewEventApi.onCameraChanged( viewId: _viewId, eventType: .onCameraMove, position: Convert.convertCameraPosition(position: position), diff --git a/ios/Classes/GoogleMapsNavigationViewFactory.swift b/ios/Classes/GoogleMapsNavigationViewFactory.swift index 60dfcea..52cbc57 100644 --- a/ios/Classes/GoogleMapsNavigationViewFactory.swift +++ b/ios/Classes/GoogleMapsNavigationViewFactory.swift @@ -17,13 +17,13 @@ import UIKit class GoogleMapsNavigationViewFactory: NSObject, FlutterPlatformViewFactory { private var viewRegistry: GoogleMapsNavigationViewRegistry - private var navigationViewEventApi: NavigationViewEventApi + private var viewEventApi: ViewEventApi private var imageRegistry: ImageRegistry init(viewRegistry: GoogleMapsNavigationViewRegistry, - navigationViewEventApi: NavigationViewEventApi, imageRegistry: ImageRegistry) { + viewEventApi: ViewEventApi, imageRegistry: ImageRegistry) { self.viewRegistry = viewRegistry - self.navigationViewEventApi = navigationViewEventApi + self.viewEventApi = viewEventApi self.imageRegistry = imageRegistry super.init() } @@ -36,19 +36,22 @@ class GoogleMapsNavigationViewFactory: NSObject, FlutterPlatformViewFactory { viewIdentifier viewId: Int64, arguments args: Any?) -> FlutterPlatformView { guard let argsList = args as? [Any?], - let params = NavigationViewCreationOptionsDto.fromList(argsList) else { - fatalError("Failed to decode NavigationViewCreationOptionsDto") + let params = ViewCreationOptionsDto.fromList(argsList) else { + fatalError("Failed to decode ViewCreationOptionsDto") } let mapConfiguration = Convert.convertMapOptions(params.mapOptions) + let isNavigationView = params.mapViewType == MapViewTypeDto.navigation + return GoogleMapsNavigationView( frame: frame, viewIdentifier: viewId, + isNavigationView: isNavigationView, viewRegistry: viewRegistry, - navigationViewEventApi: navigationViewEventApi, + viewEventApi: viewEventApi, navigationUIEnabledPreference: Convert - .convertNavigationUIEnabledPreference(preference: params.navigationViewOptions + .convertNavigationUIEnabledPreference(preference: params.navigationViewOptions? .navigationUIEnabledPreference), mapConfiguration: mapConfiguration, imageRegistry: imageRegistry diff --git a/ios/Classes/GoogleMapsNavigationViewMessageHandler.swift b/ios/Classes/GoogleMapsNavigationViewMessageHandler.swift index 5d5e080..85b95e8 100644 --- a/ios/Classes/GoogleMapsNavigationViewMessageHandler.swift +++ b/ios/Classes/GoogleMapsNavigationViewMessageHandler.swift @@ -19,7 +19,7 @@ enum GoogleMapsNavigationViewHandlerError: Error { case badFunctionCall } -class GoogleMapsNavigationViewMessageHandler: NavigationViewApi { +class GoogleMapsNavigationViewMessageHandler: MapViewApi { private let viewRegistry: GoogleMapsNavigationViewRegistry init(viewRegistry: GoogleMapsNavigationViewRegistry) { diff --git a/ios/Classes/GoogleMapsNavigationViewRegistry.swift b/ios/Classes/GoogleMapsNavigationViewRegistry.swift index b69f4db..fbdbb71 100644 --- a/ios/Classes/GoogleMapsNavigationViewRegistry.swift +++ b/ios/Classes/GoogleMapsNavigationViewRegistry.swift @@ -55,4 +55,9 @@ class GoogleMapsNavigationViewRegistry { Array(views.values) } } + + func getAllRegisteredNavigationViewIds() -> [Int64] { + // Filter the views dictionary to include only those views that are navigation views + views.filter { $0.value.isNavigationView() }.map(\.key) + } } diff --git a/ios/Classes/messages.g.swift b/ios/Classes/messages.g.swift index e00a7c6..2fb20aa 100644 --- a/ios/Classes/messages.g.swift +++ b/ios/Classes/messages.g.swift @@ -60,6 +60,15 @@ private func nilOrValue(_ value: Any?) -> T? { return value as! T? } +/// Describes the type of map to construct. +enum MapViewTypeDto: Int { + /// Navigation view supports navigation overlay, and current navigation session is displayed on + /// the map. + case navigation = 0 + /// Classic map view, without navigation overlay. + case map = 1 +} + /// Determines the initial visibility of the navigation UI on map initialization. enum NavigationUIEnabledPreferenceDto: Int { /// Navigation UI gets enabled if the navigation @@ -477,15 +486,21 @@ struct NavigationViewOptionsDto { /// specified initial parameters. /// /// Generated class from Pigeon that represents data sent in messages. -struct NavigationViewCreationOptionsDto { +struct ViewCreationOptionsDto { + var mapViewType: MapViewTypeDto var mapOptions: MapOptionsDto - var navigationViewOptions: NavigationViewOptionsDto + var navigationViewOptions: NavigationViewOptionsDto? - static func fromList(_ list: [Any?]) -> NavigationViewCreationOptionsDto? { - let mapOptions = MapOptionsDto.fromList(list[0] as! [Any?])! - let navigationViewOptions = NavigationViewOptionsDto.fromList(list[1] as! [Any?])! + static func fromList(_ list: [Any?]) -> ViewCreationOptionsDto? { + let mapViewType = MapViewTypeDto(rawValue: list[0] as! Int)! + let mapOptions = MapOptionsDto.fromList(list[1] as! [Any?])! + var navigationViewOptions: NavigationViewOptionsDto? + if let navigationViewOptionsList: [Any?] = nilOrValue(list[2]) { + navigationViewOptions = NavigationViewOptionsDto.fromList(navigationViewOptionsList) + } - return NavigationViewCreationOptionsDto( + return ViewCreationOptionsDto( + mapViewType: mapViewType, mapOptions: mapOptions, navigationViewOptions: navigationViewOptions ) @@ -493,8 +508,9 @@ struct NavigationViewCreationOptionsDto { func toList() -> [Any?] { [ + mapViewType.rawValue, mapOptions.toList(), - navigationViewOptions.toList(), + navigationViewOptions?.toList(), ] } } @@ -1692,9 +1708,9 @@ private class _NavigationViewCreationApiCodecReader: FlutterStandardReader { case 131: return MapOptionsDto.fromList(readValue() as! [Any?]) case 132: - return NavigationViewCreationOptionsDto.fromList(readValue() as! [Any?]) - case 133: return NavigationViewOptionsDto.fromList(readValue() as! [Any?]) + case 133: + return ViewCreationOptionsDto.fromList(readValue() as! [Any?]) default: return super.readValue(ofType: type) } @@ -1715,10 +1731,10 @@ private class _NavigationViewCreationApiCodecWriter: FlutterStandardWriter { } else if let value = value as? MapOptionsDto { super.writeByte(131) super.writeValue(value.toList()) - } else if let value = value as? NavigationViewCreationOptionsDto { + } else if let value = value as? NavigationViewOptionsDto { super.writeByte(132) super.writeValue(value.toList()) - } else if let value = value as? NavigationViewOptionsDto { + } else if let value = value as? ViewCreationOptionsDto { super.writeByte(133) super.writeValue(value.toList()) } else { @@ -1748,7 +1764,7 @@ class _NavigationViewCreationApiCodec: FlutterStandardMessageCodec { /// /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol _NavigationViewCreationApi { - func _create(msg: NavigationViewCreationOptionsDto) throws + func _create(msg: ViewCreationOptionsDto) throws } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -1766,7 +1782,7 @@ enum _NavigationViewCreationApiSetup { if let api { _createChannel.setMessageHandler { message, reply in let args = message as! [Any?] - let msgArg = args[0] as! NavigationViewCreationOptionsDto + let msgArg = args[0] as! ViewCreationOptionsDto do { try api._create(msg: msgArg) reply(wrapResult(nil)) @@ -1780,7 +1796,7 @@ enum _NavigationViewCreationApiSetup { } } -private class NavigationViewApiCodecReader: FlutterStandardReader { +private class MapViewApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { case 128: @@ -1827,7 +1843,7 @@ private class NavigationViewApiCodecReader: FlutterStandardReader { } } -private class NavigationViewApiCodecWriter: FlutterStandardWriter { +private class MapViewApiCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { if let value = value as? CameraPositionDto { super.writeByte(128) @@ -1892,22 +1908,22 @@ private class NavigationViewApiCodecWriter: FlutterStandardWriter { } } -private class NavigationViewApiCodecReaderWriter: FlutterStandardReaderWriter { +private class MapViewApiCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - NavigationViewApiCodecReader(data: data) + MapViewApiCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - NavigationViewApiCodecWriter(data: data) + MapViewApiCodecWriter(data: data) } } -class NavigationViewApiCodec: FlutterStandardMessageCodec { - static let shared = NavigationViewApiCodec(readerWriter: NavigationViewApiCodecReaderWriter()) +class MapViewApiCodec: FlutterStandardMessageCodec { + static let shared = MapViewApiCodec(readerWriter: MapViewApiCodecReaderWriter()) } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. -protocol NavigationViewApi { +protocol MapViewApi { func awaitMapReady(viewId: Int64, completion: @escaping (Result) -> Void) func isMyLocationEnabled(viewId: Int64) throws -> Bool func setMyLocationEnabled(viewId: Int64, enabled: Bool) throws @@ -2010,13 +2026,13 @@ protocol NavigationViewApi { } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. -enum NavigationViewApiSetup { - /// The codec used by NavigationViewApi. - static var codec: FlutterStandardMessageCodec { NavigationViewApiCodec.shared } - /// Sets up an instance of `NavigationViewApi` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: NavigationViewApi?) { +enum MapViewApiSetup { + /// The codec used by MapViewApi. + static var codec: FlutterStandardMessageCodec { MapViewApiCodec.shared } + /// Sets up an instance of `MapViewApi` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: MapViewApi?) { let awaitMapReadyChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.awaitMapReady", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.awaitMapReady", binaryMessenger: binaryMessenger, codec: codec ) @@ -2037,7 +2053,7 @@ enum NavigationViewApiSetup { awaitMapReadyChannel.setMessageHandler(nil) } let isMyLocationEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMyLocationEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMyLocationEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2056,7 +2072,7 @@ enum NavigationViewApiSetup { isMyLocationEnabledChannel.setMessageHandler(nil) } let setMyLocationEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2076,7 +2092,7 @@ enum NavigationViewApiSetup { setMyLocationEnabledChannel.setMessageHandler(nil) } let getMyLocationChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMyLocation", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMyLocation", binaryMessenger: binaryMessenger, codec: codec ) @@ -2095,7 +2111,7 @@ enum NavigationViewApiSetup { getMyLocationChannel.setMessageHandler(nil) } let getMapTypeChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMapType", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMapType", binaryMessenger: binaryMessenger, codec: codec ) @@ -2114,7 +2130,7 @@ enum NavigationViewApiSetup { getMapTypeChannel.setMessageHandler(nil) } let setMapTypeChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapType", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapType", binaryMessenger: binaryMessenger, codec: codec ) @@ -2134,7 +2150,7 @@ enum NavigationViewApiSetup { setMapTypeChannel.setMessageHandler(nil) } let setMapStyleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapStyle", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapStyle", binaryMessenger: binaryMessenger, codec: codec ) @@ -2154,7 +2170,7 @@ enum NavigationViewApiSetup { setMapStyleChannel.setMessageHandler(nil) } let isNavigationTripProgressBarEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationTripProgressBarEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationTripProgressBarEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2173,7 +2189,7 @@ enum NavigationViewApiSetup { isNavigationTripProgressBarEnabledChannel.setMessageHandler(nil) } let setNavigationTripProgressBarEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationTripProgressBarEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationTripProgressBarEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2193,7 +2209,7 @@ enum NavigationViewApiSetup { setNavigationTripProgressBarEnabledChannel.setMessageHandler(nil) } let isNavigationHeaderEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationHeaderEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationHeaderEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2212,7 +2228,7 @@ enum NavigationViewApiSetup { isNavigationHeaderEnabledChannel.setMessageHandler(nil) } let setNavigationHeaderEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationHeaderEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationHeaderEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2232,7 +2248,7 @@ enum NavigationViewApiSetup { setNavigationHeaderEnabledChannel.setMessageHandler(nil) } let isNavigationFooterEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationFooterEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationFooterEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2251,7 +2267,7 @@ enum NavigationViewApiSetup { isNavigationFooterEnabledChannel.setMessageHandler(nil) } let setNavigationFooterEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationFooterEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationFooterEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2271,7 +2287,7 @@ enum NavigationViewApiSetup { setNavigationFooterEnabledChannel.setMessageHandler(nil) } let isRecenterButtonEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isRecenterButtonEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isRecenterButtonEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2290,7 +2306,7 @@ enum NavigationViewApiSetup { isRecenterButtonEnabledChannel.setMessageHandler(nil) } let setRecenterButtonEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRecenterButtonEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRecenterButtonEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2310,7 +2326,7 @@ enum NavigationViewApiSetup { setRecenterButtonEnabledChannel.setMessageHandler(nil) } let isSpeedLimitIconEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isSpeedLimitIconEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isSpeedLimitIconEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2329,7 +2345,7 @@ enum NavigationViewApiSetup { isSpeedLimitIconEnabledChannel.setMessageHandler(nil) } let setSpeedLimitIconEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedLimitIconEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedLimitIconEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2349,7 +2365,7 @@ enum NavigationViewApiSetup { setSpeedLimitIconEnabledChannel.setMessageHandler(nil) } let isSpeedometerEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isSpeedometerEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isSpeedometerEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2368,7 +2384,7 @@ enum NavigationViewApiSetup { isSpeedometerEnabledChannel.setMessageHandler(nil) } let setSpeedometerEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedometerEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedometerEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2388,7 +2404,7 @@ enum NavigationViewApiSetup { setSpeedometerEnabledChannel.setMessageHandler(nil) } let isTrafficIncidentCardsEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTrafficIncidentCardsEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTrafficIncidentCardsEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2407,7 +2423,7 @@ enum NavigationViewApiSetup { isTrafficIncidentCardsEnabledChannel.setMessageHandler(nil) } let setTrafficIncidentCardsEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficIncidentCardsEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficIncidentCardsEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2427,7 +2443,7 @@ enum NavigationViewApiSetup { setTrafficIncidentCardsEnabledChannel.setMessageHandler(nil) } let isNavigationUIEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationUIEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationUIEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2446,7 +2462,7 @@ enum NavigationViewApiSetup { isNavigationUIEnabledChannel.setMessageHandler(nil) } let setNavigationUIEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationUIEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationUIEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -2466,7 +2482,7 @@ enum NavigationViewApiSetup { setNavigationUIEnabledChannel.setMessageHandler(nil) } let getCameraPositionChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getCameraPosition", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getCameraPosition", binaryMessenger: binaryMessenger, codec: codec ) @@ -2485,7 +2501,7 @@ enum NavigationViewApiSetup { getCameraPositionChannel.setMessageHandler(nil) } let getVisibleRegionChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getVisibleRegion", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getVisibleRegion", binaryMessenger: binaryMessenger, codec: codec ) @@ -2504,7 +2520,7 @@ enum NavigationViewApiSetup { getVisibleRegionChannel.setMessageHandler(nil) } let followMyLocationChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.followMyLocation", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.followMyLocation", binaryMessenger: binaryMessenger, codec: codec ) @@ -2529,7 +2545,7 @@ enum NavigationViewApiSetup { followMyLocationChannel.setMessageHandler(nil) } let animateCameraToCameraPositionChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToCameraPosition", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToCameraPosition", binaryMessenger: binaryMessenger, codec: codec ) @@ -2557,7 +2573,7 @@ enum NavigationViewApiSetup { animateCameraToCameraPositionChannel.setMessageHandler(nil) } let animateCameraToLatLngChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLng", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLng", binaryMessenger: binaryMessenger, codec: codec ) @@ -2583,7 +2599,7 @@ enum NavigationViewApiSetup { animateCameraToLatLngChannel.setMessageHandler(nil) } let animateCameraToLatLngBoundsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngBounds", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngBounds", binaryMessenger: binaryMessenger, codec: codec ) @@ -2613,7 +2629,7 @@ enum NavigationViewApiSetup { animateCameraToLatLngBoundsChannel.setMessageHandler(nil) } let animateCameraToLatLngZoomChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngZoom", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngZoom", binaryMessenger: binaryMessenger, codec: codec ) @@ -2643,7 +2659,7 @@ enum NavigationViewApiSetup { animateCameraToLatLngZoomChannel.setMessageHandler(nil) } let animateCameraByScrollChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByScroll", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByScroll", binaryMessenger: binaryMessenger, codec: codec ) @@ -2673,7 +2689,7 @@ enum NavigationViewApiSetup { animateCameraByScrollChannel.setMessageHandler(nil) } let animateCameraByZoomChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByZoom", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByZoom", binaryMessenger: binaryMessenger, codec: codec ) @@ -2705,7 +2721,7 @@ enum NavigationViewApiSetup { animateCameraByZoomChannel.setMessageHandler(nil) } let animateCameraToZoomChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToZoom", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToZoom", binaryMessenger: binaryMessenger, codec: codec ) @@ -2729,7 +2745,7 @@ enum NavigationViewApiSetup { animateCameraToZoomChannel.setMessageHandler(nil) } let moveCameraToCameraPositionChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToCameraPosition", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToCameraPosition", binaryMessenger: binaryMessenger, codec: codec ) @@ -2749,7 +2765,7 @@ enum NavigationViewApiSetup { moveCameraToCameraPositionChannel.setMessageHandler(nil) } let moveCameraToLatLngChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLng", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLng", binaryMessenger: binaryMessenger, codec: codec ) @@ -2769,7 +2785,7 @@ enum NavigationViewApiSetup { moveCameraToLatLngChannel.setMessageHandler(nil) } let moveCameraToLatLngBoundsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngBounds", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngBounds", binaryMessenger: binaryMessenger, codec: codec ) @@ -2794,7 +2810,7 @@ enum NavigationViewApiSetup { moveCameraToLatLngBoundsChannel.setMessageHandler(nil) } let moveCameraToLatLngZoomChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngZoom", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngZoom", binaryMessenger: binaryMessenger, codec: codec ) @@ -2815,7 +2831,7 @@ enum NavigationViewApiSetup { moveCameraToLatLngZoomChannel.setMessageHandler(nil) } let moveCameraByScrollChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByScroll", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByScroll", binaryMessenger: binaryMessenger, codec: codec ) @@ -2840,7 +2856,7 @@ enum NavigationViewApiSetup { moveCameraByScrollChannel.setMessageHandler(nil) } let moveCameraByZoomChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByZoom", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByZoom", binaryMessenger: binaryMessenger, codec: codec ) @@ -2867,7 +2883,7 @@ enum NavigationViewApiSetup { moveCameraByZoomChannel.setMessageHandler(nil) } let moveCameraToZoomChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToZoom", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToZoom", binaryMessenger: binaryMessenger, codec: codec ) @@ -2887,7 +2903,7 @@ enum NavigationViewApiSetup { moveCameraToZoomChannel.setMessageHandler(nil) } let showRouteOverviewChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.showRouteOverview", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.showRouteOverview", binaryMessenger: binaryMessenger, codec: codec ) @@ -2906,7 +2922,7 @@ enum NavigationViewApiSetup { showRouteOverviewChannel.setMessageHandler(nil) } let getMinZoomPreferenceChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMinZoomPreference", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMinZoomPreference", binaryMessenger: binaryMessenger, codec: codec ) @@ -2925,7 +2941,7 @@ enum NavigationViewApiSetup { getMinZoomPreferenceChannel.setMessageHandler(nil) } let getMaxZoomPreferenceChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMaxZoomPreference", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMaxZoomPreference", binaryMessenger: binaryMessenger, codec: codec ) @@ -2944,7 +2960,7 @@ enum NavigationViewApiSetup { getMaxZoomPreferenceChannel.setMessageHandler(nil) } let resetMinMaxZoomPreferenceChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.resetMinMaxZoomPreference", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.resetMinMaxZoomPreference", binaryMessenger: binaryMessenger, codec: codec ) @@ -2963,7 +2979,7 @@ enum NavigationViewApiSetup { resetMinMaxZoomPreferenceChannel.setMessageHandler(nil) } let setMinZoomPreferenceChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMinZoomPreference", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMinZoomPreference", binaryMessenger: binaryMessenger, codec: codec ) @@ -2983,7 +2999,7 @@ enum NavigationViewApiSetup { setMinZoomPreferenceChannel.setMessageHandler(nil) } let setMaxZoomPreferenceChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMaxZoomPreference", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMaxZoomPreference", binaryMessenger: binaryMessenger, codec: codec ) @@ -3003,7 +3019,7 @@ enum NavigationViewApiSetup { setMaxZoomPreferenceChannel.setMessageHandler(nil) } let setMyLocationButtonEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationButtonEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationButtonEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3023,7 +3039,7 @@ enum NavigationViewApiSetup { setMyLocationButtonEnabledChannel.setMessageHandler(nil) } let setConsumeMyLocationButtonClickEventsEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setConsumeMyLocationButtonClickEventsEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setConsumeMyLocationButtonClickEventsEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3046,7 +3062,7 @@ enum NavigationViewApiSetup { setConsumeMyLocationButtonClickEventsEnabledChannel.setMessageHandler(nil) } let setZoomGesturesEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomGesturesEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomGesturesEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3066,7 +3082,7 @@ enum NavigationViewApiSetup { setZoomGesturesEnabledChannel.setMessageHandler(nil) } let setZoomControlsEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomControlsEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomControlsEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3086,7 +3102,7 @@ enum NavigationViewApiSetup { setZoomControlsEnabledChannel.setMessageHandler(nil) } let setCompassEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setCompassEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setCompassEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3106,7 +3122,7 @@ enum NavigationViewApiSetup { setCompassEnabledChannel.setMessageHandler(nil) } let setRotateGesturesEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRotateGesturesEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRotateGesturesEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3126,7 +3142,7 @@ enum NavigationViewApiSetup { setRotateGesturesEnabledChannel.setMessageHandler(nil) } let setScrollGesturesEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3146,7 +3162,7 @@ enum NavigationViewApiSetup { setScrollGesturesEnabledChannel.setMessageHandler(nil) } let setScrollGesturesDuringRotateOrZoomEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesDuringRotateOrZoomEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesDuringRotateOrZoomEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3166,7 +3182,7 @@ enum NavigationViewApiSetup { setScrollGesturesDuringRotateOrZoomEnabledChannel.setMessageHandler(nil) } let setTiltGesturesEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTiltGesturesEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTiltGesturesEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3186,7 +3202,7 @@ enum NavigationViewApiSetup { setTiltGesturesEnabledChannel.setMessageHandler(nil) } let setMapToolbarEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapToolbarEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapToolbarEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3206,7 +3222,7 @@ enum NavigationViewApiSetup { setMapToolbarEnabledChannel.setMessageHandler(nil) } let setTrafficEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3226,7 +3242,7 @@ enum NavigationViewApiSetup { setTrafficEnabledChannel.setMessageHandler(nil) } let isMyLocationButtonEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMyLocationButtonEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMyLocationButtonEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3245,7 +3261,7 @@ enum NavigationViewApiSetup { isMyLocationButtonEnabledChannel.setMessageHandler(nil) } let isConsumeMyLocationButtonClickEventsEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isConsumeMyLocationButtonClickEventsEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isConsumeMyLocationButtonClickEventsEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3264,7 +3280,7 @@ enum NavigationViewApiSetup { isConsumeMyLocationButtonClickEventsEnabledChannel.setMessageHandler(nil) } let isZoomGesturesEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isZoomGesturesEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isZoomGesturesEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3283,7 +3299,7 @@ enum NavigationViewApiSetup { isZoomGesturesEnabledChannel.setMessageHandler(nil) } let isZoomControlsEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isZoomControlsEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isZoomControlsEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3302,7 +3318,7 @@ enum NavigationViewApiSetup { isZoomControlsEnabledChannel.setMessageHandler(nil) } let isCompassEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isCompassEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isCompassEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3321,7 +3337,7 @@ enum NavigationViewApiSetup { isCompassEnabledChannel.setMessageHandler(nil) } let isRotateGesturesEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isRotateGesturesEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isRotateGesturesEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3340,7 +3356,7 @@ enum NavigationViewApiSetup { isRotateGesturesEnabledChannel.setMessageHandler(nil) } let isScrollGesturesEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isScrollGesturesEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isScrollGesturesEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3359,7 +3375,7 @@ enum NavigationViewApiSetup { isScrollGesturesEnabledChannel.setMessageHandler(nil) } let isScrollGesturesEnabledDuringRotateOrZoomChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isScrollGesturesEnabledDuringRotateOrZoom", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isScrollGesturesEnabledDuringRotateOrZoom", binaryMessenger: binaryMessenger, codec: codec ) @@ -3378,7 +3394,7 @@ enum NavigationViewApiSetup { isScrollGesturesEnabledDuringRotateOrZoomChannel.setMessageHandler(nil) } let isTiltGesturesEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTiltGesturesEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTiltGesturesEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3397,7 +3413,7 @@ enum NavigationViewApiSetup { isTiltGesturesEnabledChannel.setMessageHandler(nil) } let isMapToolbarEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMapToolbarEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMapToolbarEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3416,7 +3432,7 @@ enum NavigationViewApiSetup { isMapToolbarEnabledChannel.setMessageHandler(nil) } let isTrafficEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTrafficEnabled", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTrafficEnabled", binaryMessenger: binaryMessenger, codec: codec ) @@ -3435,7 +3451,7 @@ enum NavigationViewApiSetup { isTrafficEnabledChannel.setMessageHandler(nil) } let getMarkersChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMarkers", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMarkers", binaryMessenger: binaryMessenger, codec: codec ) @@ -3454,7 +3470,7 @@ enum NavigationViewApiSetup { getMarkersChannel.setMessageHandler(nil) } let addMarkersChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addMarkers", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addMarkers", binaryMessenger: binaryMessenger, codec: codec ) @@ -3474,7 +3490,7 @@ enum NavigationViewApiSetup { addMarkersChannel.setMessageHandler(nil) } let updateMarkersChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateMarkers", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateMarkers", binaryMessenger: binaryMessenger, codec: codec ) @@ -3494,7 +3510,7 @@ enum NavigationViewApiSetup { updateMarkersChannel.setMessageHandler(nil) } let removeMarkersChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeMarkers", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeMarkers", binaryMessenger: binaryMessenger, codec: codec ) @@ -3514,7 +3530,7 @@ enum NavigationViewApiSetup { removeMarkersChannel.setMessageHandler(nil) } let clearMarkersChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearMarkers", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearMarkers", binaryMessenger: binaryMessenger, codec: codec ) @@ -3533,7 +3549,7 @@ enum NavigationViewApiSetup { clearMarkersChannel.setMessageHandler(nil) } let clearChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clear", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clear", binaryMessenger: binaryMessenger, codec: codec ) @@ -3552,7 +3568,7 @@ enum NavigationViewApiSetup { clearChannel.setMessageHandler(nil) } let getPolygonsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getPolygons", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getPolygons", binaryMessenger: binaryMessenger, codec: codec ) @@ -3571,7 +3587,7 @@ enum NavigationViewApiSetup { getPolygonsChannel.setMessageHandler(nil) } let addPolygonsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolygons", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolygons", binaryMessenger: binaryMessenger, codec: codec ) @@ -3591,7 +3607,7 @@ enum NavigationViewApiSetup { addPolygonsChannel.setMessageHandler(nil) } let updatePolygonsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolygons", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolygons", binaryMessenger: binaryMessenger, codec: codec ) @@ -3611,7 +3627,7 @@ enum NavigationViewApiSetup { updatePolygonsChannel.setMessageHandler(nil) } let removePolygonsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolygons", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolygons", binaryMessenger: binaryMessenger, codec: codec ) @@ -3631,7 +3647,7 @@ enum NavigationViewApiSetup { removePolygonsChannel.setMessageHandler(nil) } let clearPolygonsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearPolygons", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearPolygons", binaryMessenger: binaryMessenger, codec: codec ) @@ -3650,7 +3666,7 @@ enum NavigationViewApiSetup { clearPolygonsChannel.setMessageHandler(nil) } let getPolylinesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getPolylines", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getPolylines", binaryMessenger: binaryMessenger, codec: codec ) @@ -3669,7 +3685,7 @@ enum NavigationViewApiSetup { getPolylinesChannel.setMessageHandler(nil) } let addPolylinesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolylines", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolylines", binaryMessenger: binaryMessenger, codec: codec ) @@ -3689,7 +3705,7 @@ enum NavigationViewApiSetup { addPolylinesChannel.setMessageHandler(nil) } let updatePolylinesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolylines", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolylines", binaryMessenger: binaryMessenger, codec: codec ) @@ -3709,7 +3725,7 @@ enum NavigationViewApiSetup { updatePolylinesChannel.setMessageHandler(nil) } let removePolylinesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolylines", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolylines", binaryMessenger: binaryMessenger, codec: codec ) @@ -3729,7 +3745,7 @@ enum NavigationViewApiSetup { removePolylinesChannel.setMessageHandler(nil) } let clearPolylinesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearPolylines", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearPolylines", binaryMessenger: binaryMessenger, codec: codec ) @@ -3748,7 +3764,7 @@ enum NavigationViewApiSetup { clearPolylinesChannel.setMessageHandler(nil) } let getCirclesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getCircles", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getCircles", binaryMessenger: binaryMessenger, codec: codec ) @@ -3767,7 +3783,7 @@ enum NavigationViewApiSetup { getCirclesChannel.setMessageHandler(nil) } let addCirclesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addCircles", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addCircles", binaryMessenger: binaryMessenger, codec: codec ) @@ -3787,7 +3803,7 @@ enum NavigationViewApiSetup { addCirclesChannel.setMessageHandler(nil) } let updateCirclesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateCircles", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateCircles", binaryMessenger: binaryMessenger, codec: codec ) @@ -3807,7 +3823,7 @@ enum NavigationViewApiSetup { updateCirclesChannel.setMessageHandler(nil) } let removeCirclesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeCircles", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeCircles", binaryMessenger: binaryMessenger, codec: codec ) @@ -3827,7 +3843,7 @@ enum NavigationViewApiSetup { removeCirclesChannel.setMessageHandler(nil) } let clearCirclesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearCircles", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearCircles", binaryMessenger: binaryMessenger, codec: codec ) @@ -3846,7 +3862,7 @@ enum NavigationViewApiSetup { clearCirclesChannel.setMessageHandler(nil) } let registerOnCameraChangedListenerChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.registerOnCameraChangedListener", + name: "dev.flutter.pigeon.google_navigation_flutter.MapViewApi.registerOnCameraChangedListener", binaryMessenger: binaryMessenger, codec: codec ) @@ -4009,7 +4025,7 @@ enum ImageRegistryApiSetup { } } -private class NavigationViewEventApiCodecReader: FlutterStandardReader { +private class ViewEventApiCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { case 128: @@ -4022,7 +4038,7 @@ private class NavigationViewEventApiCodecReader: FlutterStandardReader { } } -private class NavigationViewEventApiCodecWriter: FlutterStandardWriter { +private class ViewEventApiCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { if let value = value as? CameraPositionDto { super.writeByte(128) @@ -4036,23 +4052,22 @@ private class NavigationViewEventApiCodecWriter: FlutterStandardWriter { } } -private class NavigationViewEventApiCodecReaderWriter: FlutterStandardReaderWriter { +private class ViewEventApiCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - NavigationViewEventApiCodecReader(data: data) + ViewEventApiCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - NavigationViewEventApiCodecWriter(data: data) + ViewEventApiCodecWriter(data: data) } } -class NavigationViewEventApiCodec: FlutterStandardMessageCodec { - static let shared = - NavigationViewEventApiCodec(readerWriter: NavigationViewEventApiCodecReaderWriter()) +class ViewEventApiCodec: FlutterStandardMessageCodec { + static let shared = ViewEventApiCodec(readerWriter: ViewEventApiCodecReaderWriter()) } /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. -protocol NavigationViewEventApiProtocol { +protocol ViewEventApiProtocol { func onMapClickEvent(viewId viewIdArg: Int64, latLng latLngArg: LatLngDto, completion: @escaping (Result) -> Void) func onMapLongClickEvent(viewId viewIdArg: Int64, latLng latLngArg: LatLngDto, @@ -4084,20 +4099,19 @@ protocol NavigationViewEventApiProtocol { completion: @escaping (Result) -> Void) } -class NavigationViewEventApi: NavigationViewEventApiProtocol { +class ViewEventApi: ViewEventApiProtocol { private let binaryMessenger: FlutterBinaryMessenger init(binaryMessenger: FlutterBinaryMessenger) { self.binaryMessenger = binaryMessenger } var codec: FlutterStandardMessageCodec { - NavigationViewEventApiCodec.shared + ViewEventApiCodec.shared } func onMapClickEvent(viewId viewIdArg: Int64, latLng latLngArg: LatLngDto, completion: @escaping (Result) -> Void) { - let channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMapClickEvent" + let channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMapClickEvent" let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, @@ -4122,7 +4136,7 @@ class NavigationViewEventApi: NavigationViewEventApiProtocol { func onMapLongClickEvent(viewId viewIdArg: Int64, latLng latLngArg: LatLngDto, completion: @escaping (Result) -> Void) { let channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMapLongClickEvent" + "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMapLongClickEvent" let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, @@ -4147,7 +4161,7 @@ class NavigationViewEventApi: NavigationViewEventApiProtocol { func onRecenterButtonClicked(viewId viewIdArg: Int64, completion: @escaping (Result) -> Void) { let channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onRecenterButtonClicked" + "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onRecenterButtonClicked" let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, @@ -4172,8 +4186,7 @@ class NavigationViewEventApi: NavigationViewEventApiProtocol { func onMarkerEvent(viewId viewIdArg: Int64, markerId markerIdArg: String, eventType eventTypeArg: MarkerEventTypeDto, completion: @escaping (Result) -> Void) { - let channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerEvent" + let channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerEvent" let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, @@ -4199,8 +4212,7 @@ class NavigationViewEventApi: NavigationViewEventApiProtocol { eventType eventTypeArg: MarkerDragEventTypeDto, position positionArg: LatLngDto, completion: @escaping (Result) -> Void) { - let channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerDragEvent" + let channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerDragEvent" let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, @@ -4226,8 +4238,7 @@ class NavigationViewEventApi: NavigationViewEventApiProtocol { func onPolygonClicked(viewId viewIdArg: Int64, polygonId polygonIdArg: String, completion: @escaping (Result) -> Void) { - let channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onPolygonClicked" + let channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onPolygonClicked" let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, @@ -4251,8 +4262,7 @@ class NavigationViewEventApi: NavigationViewEventApiProtocol { func onPolylineClicked(viewId viewIdArg: Int64, polylineId polylineIdArg: String, completion: @escaping (Result) -> Void) { - let channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onPolylineClicked" + let channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onPolylineClicked" let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, @@ -4276,8 +4286,7 @@ class NavigationViewEventApi: NavigationViewEventApiProtocol { func onCircleClicked(viewId viewIdArg: Int64, circleId circleIdArg: String, completion: @escaping (Result) -> Void) { - let channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCircleClicked" + let channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCircleClicked" let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, @@ -4303,7 +4312,7 @@ class NavigationViewEventApi: NavigationViewEventApiProtocol { navigationUIEnabled navigationUIEnabledArg: Bool, completion: @escaping (Result) -> Void) { let channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onNavigationUIEnabledChanged" + "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onNavigationUIEnabledChanged" let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, @@ -4328,7 +4337,7 @@ class NavigationViewEventApi: NavigationViewEventApiProtocol { func onMyLocationClicked(viewId viewIdArg: Int64, completion: @escaping (Result) -> Void) { let channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMyLocationClicked" + "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMyLocationClicked" let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, @@ -4353,7 +4362,7 @@ class NavigationViewEventApi: NavigationViewEventApiProtocol { func onMyLocationButtonClicked(viewId viewIdArg: Int64, completion: @escaping (Result) -> Void) { let channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMyLocationButtonClicked" + "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMyLocationButtonClicked" let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, @@ -4378,8 +4387,7 @@ class NavigationViewEventApi: NavigationViewEventApiProtocol { func onCameraChanged(viewId viewIdArg: Int64, eventType eventTypeArg: CameraEventTypeDto, position positionArg: CameraPositionDto, completion: @escaping (Result) -> Void) { - let channelName = - "dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCameraChanged" + let channelName = "dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCameraChanged" let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, diff --git a/lib/google_navigation_flutter.dart b/lib/google_navigation_flutter.dart index 8b01d9a..6143322 100644 --- a/lib/google_navigation_flutter.dart +++ b/lib/google_navigation_flutter.dart @@ -18,3 +18,7 @@ export 'src/google_navigation_flutter_android.dart'; export 'src/google_navigation_flutter_ios.dart'; export 'src/navigator/google_navigation_flutter_navigator.dart'; export 'src/types/types.dart'; +export 'src/google_maps_navigation_view.dart'; +export 'src/google_maps_map_view.dart'; +export 'src/google_maps_map_view_controller.dart'; +export 'src/google_maps_navigation_view_controller.dart'; diff --git a/lib/src/google_maps_map_view.dart b/lib/src/google_maps_map_view.dart new file mode 100644 index 0000000..c29a809 --- /dev/null +++ b/lib/src/google_maps_map_view.dart @@ -0,0 +1,393 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; + +import '../google_navigation_flutter.dart'; +import 'google_navigation_flutter_platform_interface.dart'; + +/// On Google Map view created callback. +typedef OnMapViewCreatedCallback = void Function( + GoogleMapViewController controller, +); + +/// The base view for map view and navigation view. Not to be used by itself. +/// {@category Map View} +@protected +abstract class GoogleMapsBaseMapView extends StatefulWidget { + /// Abstract base class that contans the shared logic of GoogleMapsMapView and GoogleMapsNavigation View. + const GoogleMapsBaseMapView( + {super.key, + this.initialCameraPosition = const CameraPosition(), + this.initialMapType = MapType.normal, + this.initialCompassEnabled = true, + this.initialRotateGesturesEnabled = true, + this.initialScrollGesturesEnabled = true, + this.initialTiltGesturesEnabled = true, + this.initialZoomGesturesEnabled = true, + this.initialScrollGesturesEnabledDuringRotateOrZoom = true, + this.initialMapToolbarEnabled = true, + this.initialMinZoomPreference, + this.initialMaxZoomPreference, + this.initialZoomControlsEnabled = true, + this.initialCameraTargetBounds, + this.layoutDirection, + this.gestureRecognizers = const >{}, + this.onRecenterButtonClicked, + this.onMarkerClicked, + this.onMarkerDrag, + this.onMarkerDragStart, + this.onMarkerDragEnd, + this.onMarkerInfoWindowClicked, + this.onMarkerInfoWindowClosed, + this.onMarkerInfoWindowLongClicked, + this.onMapClicked, + this.onMapLongClicked, + this.onPolygonClicked, + this.onPolylineClicked, + this.onCircleClicked, + this.onMyLocationClicked, + this.onMyLocationButtonClicked, + this.onCameraMoveStarted, + this.onCameraMove, + this.onCameraIdle, + this.onCameraStartedFollowingLocation, + this.onCameraStoppedFollowingLocation}); + + /// The initial positioning of the camera in the map view. + final CameraPosition initialCameraPosition; + + /// The directionality to be used for text layout within the embedded view. + final TextDirection? layoutDirection; + + /// The type of map to display, specified using [MapType] enum values. + final MapType initialMapType; + + /// Specifies whether the compass should be enabled. + /// + /// The compass is an icon on the map that indicates the direction of north on the map. + /// If enabled, it is only shown when the camera is tilted or rotated away from + /// its default orientation (tilt of 0 and a bearing of 0). + /// + /// By default, the compass is enabled. + final bool initialCompassEnabled; + + /// Specifies whether rotate gestures should be enabled. + /// + /// If enabled, users can use a two-finger rotate gesture to rotate the camera. + /// If disabled, users cannot rotate the camera via gestures. + /// This setting doesn't restrict the user from tapping the compass icon to reset the camera orientation, + /// nor does it restrict programmatic movements and animation of the camera. + /// + /// By default, the rotation gestures are enabled. + final bool initialRotateGesturesEnabled; + + /// Specifies whether scroll gestures should be enabled. + /// + /// By default, the scroll gestures are enabled. + final bool initialScrollGesturesEnabled; + + /// Specifies whether tilt gestures should be enabled. + /// + /// By default, the tilt gestures are enabled. + final bool initialTiltGesturesEnabled; + + /// Specifies whether zoom gestures should be enabled. + /// + /// By default, the zoom gestures enabled. + final bool initialZoomGesturesEnabled; + + /// Specifies whether scroll gestures during rotate or zoom should be enabled. + /// + /// If enabled, users can swipe to pan the camera. If disabled, swiping has no effect. + /// This setting doesn't restrict programmatic movement and animation of the camera. + /// + /// By default, the zoom gestures enabled. + final bool initialScrollGesturesEnabledDuringRotateOrZoom; + + /// Specifies whether the map toolbar should be enabled. Only applicable on Android. + /// + /// If enabled, and the map toolbar can be shown in the current context, + /// users will see a bar with various context-dependent actions. + /// + /// By default, the map toolbar is enabled. + final bool initialMapToolbarEnabled; + + /// Specifies a preferred lower bound for camera zoom. + /// + /// Null by default (not limited). + final double? initialMinZoomPreference; + + /// Specifies a preferred upper bound for camera zoom. + /// + /// Null by default (not limited). + final double? initialMaxZoomPreference; + + /// Specifies whether the zoom controls should be enabled. Only applicable on Android. + /// + /// By default, the zoom controls are enabled. + final bool initialZoomControlsEnabled; + + /// Specifies a bounds to constrain the camera target, so that when users scroll and pan the map, + /// the camera target does not move outside these bounds. + /// + /// Null by default (unbounded). + final LatLngBounds? initialCameraTargetBounds; + + /// Which gestures should be forwarded to the PlatformView. + /// + /// When this set is empty, the map will only handle pointer events for gestures that + /// were not claimed by any other gesture recognizer. + /// + /// See [PlatformViewSurface.gestureRecognizers] for details. + final Set> gestureRecognizers; + + /// On recenter button clicked event callback. + final OnRecenterButtonClicked? onRecenterButtonClicked; + + /// On marker clicked callback. + final OnMarkerClicked? onMarkerClicked; + + /// On marker drag callback. + final OnMarkerDrag? onMarkerDrag; + + /// On marker drag start callback. + final OnMarkerDragStart? onMarkerDragStart; + + /// On marker drag end callback. + final OnMarkerDragEnd? onMarkerDragEnd; + + /// On marker info window clicked callback. + final OnMarkerInfoWindowClicked? onMarkerInfoWindowClicked; + + /// On marker info window closed callback. + final OnMarkerInfoWindowClosed? onMarkerInfoWindowClosed; + + /// On marker info window long clicked callback. + final OnMarkerInfoWindowLongClicked? onMarkerInfoWindowLongClicked; + + /// On map clicked callback. + final OnMapClicked? onMapClicked; + + /// On map long clicked callback. + final OnMapLongClicked? onMapLongClicked; + + /// On polygon clicked callback. + final OnPolygonClicked? onPolygonClicked; + + /// On polyline clicked callback. + final OnPolylineClicked? onPolylineClicked; + + /// On circle clicked callback. + final OnCircleClicked? onCircleClicked; + + /// On my location clicked callback. + final OnMyLocationClicked? onMyLocationClicked; + + /// On my location button clicked callback. + final OnMyLocationButtonClicked? onMyLocationButtonClicked; + + /// On camera move started callback. + final OnCameraMoveStarted? onCameraMoveStarted; + + /// On camera move callback. + final OnCameraMove? onCameraMove; + + /// On camera idle callback. + final OnCameraIdle? onCameraIdle; + + /// On camera started following location callback (Android-only). + final OnCameraStartedFollowingLocation? onCameraStartedFollowingLocation; + + /// On camera stopped following location callback (Android-only). + final OnCameraStoppedFollowingLocation? onCameraStoppedFollowingLocation; +} + +/// The main map view widget for Google Maps Map View. +/// {@category Map View} +class GoogleMapsMapView extends GoogleMapsBaseMapView { + /// The main widget for embedding Google Maps Map View into a Flutter application. + /// + /// After creating the map view, the [onViewCreated] callback is triggered, providing a + /// [GoogleMapViewController] that you can use to interact with the map programmatically. + /// + /// Example usage: + /// ```dart + /// GoogleMapsMapView( + /// onViewCreated: (controller) { + /// // Use the controller to interact with the map. + /// }, + /// initialCameraPosition: CameraPosition( + /// // Initial camera position parameters + /// ), + /// // Other initial map settings... + /// ) + /// ``` + const GoogleMapsMapView( + {super.key, + required this.onViewCreated, + super.initialCameraPosition = const CameraPosition(), + super.initialMapType = MapType.normal, + super.initialCompassEnabled = true, + super.initialRotateGesturesEnabled = true, + super.initialScrollGesturesEnabled = true, + super.initialTiltGesturesEnabled = true, + super.initialZoomGesturesEnabled = true, + super.initialScrollGesturesEnabledDuringRotateOrZoom = true, + super.initialMapToolbarEnabled = true, + super.initialMinZoomPreference, + super.initialMaxZoomPreference, + super.initialZoomControlsEnabled = true, + super.initialCameraTargetBounds, + super.layoutDirection, + super.gestureRecognizers = + const >{}, + super.onRecenterButtonClicked, + super.onMarkerClicked, + super.onMarkerDrag, + super.onMarkerDragStart, + super.onMarkerDragEnd, + super.onMarkerInfoWindowClicked, + super.onMarkerInfoWindowClosed, + super.onMarkerInfoWindowLongClicked, + super.onMapClicked, + super.onMapLongClicked, + super.onPolygonClicked, + super.onPolylineClicked, + super.onCircleClicked, + super.onMyLocationClicked, + super.onMyLocationButtonClicked, + super.onCameraMoveStarted, + super.onCameraMove, + super.onCameraIdle, + super.onCameraStartedFollowingLocation, + super.onCameraStoppedFollowingLocation}); + + /// On view created callback. + final OnMapViewCreatedCallback onViewCreated; + + /// Creates a [State] for this [GoogleMapsMapView]. + @override + State createState() => GoogleMapsMapViewState(); +} + +abstract class MapViewState extends State { + @protected + void initMapViewListeners(int viewId) { + if (widget.onMapClicked != null) { + GoogleMapsNavigationPlatform.instance + .getMapClickEventStream(viewId: viewId) + .listen((MapClickEvent event) { + widget.onMapClicked!(event.target); + }); + } + + if (widget.onMapLongClicked != null) { + GoogleMapsNavigationPlatform.instance + .getMapLongClickEventStream(viewId: viewId) + .listen((MapLongClickEvent event) { + widget.onMapLongClicked!(event.target); + }); + } + + GoogleMapsNavigationPlatform.instance + .getMarkerEventStream(viewId: viewId) + .listen((MarkerEvent event) { + switch (event.eventType) { + case MarkerEventType.clicked: + widget.onMarkerClicked?.call(event.markerId); + case MarkerEventType.infoWindowClicked: + widget.onMarkerInfoWindowClicked?.call(event.markerId); + case MarkerEventType.infoWindowClosed: + widget.onMarkerInfoWindowClosed?.call(event.markerId); + case MarkerEventType.infoWindowLongClicked: + widget.onMarkerInfoWindowLongClicked?.call(event.markerId); + } + }); + + GoogleMapsNavigationPlatform.instance + .getMarkerDragEventStream(viewId: viewId) + .listen((MarkerDragEvent event) { + switch (event.eventType) { + case MarkerDragEventType.drag: + widget.onMarkerDrag?.call(event.markerId, event.position); + case MarkerDragEventType.dragEnd: + widget.onMarkerDragEnd?.call(event.markerId, event.position); + case MarkerDragEventType.dragStart: + widget.onMarkerDragStart?.call(event.markerId, event.position); + } + + GoogleMapsNavigationPlatform.instance + .getPolygonClickedEventStream(viewId: viewId) + .listen((PolygonClickedEvent event) { + widget.onPolygonClicked?.call(event.polygonId); + }); + + GoogleMapsNavigationPlatform.instance + .getPolylineClickedEventStream(viewId: viewId) + .listen((PolylineClickedEvent event) { + widget.onPolylineClicked?.call(event.polylineId); + }); + + GoogleMapsNavigationPlatform.instance + .getCircleClickedEventStream(viewId: viewId) + .listen((CircleClickedEvent event) { + widget.onCircleClicked?.call(event.circleId); + }); + }); + } +} + +/// Google Maps Map View. +/// {@category Map View} +class GoogleMapsMapViewState extends MapViewState { + @override + Widget build(BuildContext context) { + return GoogleMapsNavigationPlatform.instance.buildMapView( + initializationOptions: MapViewInitializationOptions( + layoutDirection: widget.layoutDirection ?? + Directionality.maybeOf(context) ?? + TextDirection.ltr, + gestureRecognizers: widget.gestureRecognizers, + mapOptions: MapOptions( + cameraPosition: widget.initialCameraPosition, + mapType: widget.initialMapType, + compassEnabled: widget.initialCompassEnabled, + rotateGesturesEnabled: widget.initialRotateGesturesEnabled, + scrollGesturesEnabled: widget.initialScrollGesturesEnabled, + tiltGesturesEnabled: widget.initialTiltGesturesEnabled, + zoomGesturesEnabled: widget.initialZoomGesturesEnabled, + scrollGesturesEnabledDuringRotateOrZoom: + widget.initialScrollGesturesEnabledDuringRotateOrZoom, + mapToolbarEnabled: widget.initialMapToolbarEnabled, + minZoomPreference: widget.initialMinZoomPreference, + maxZoomPreference: widget.initialMaxZoomPreference, + zoomControlsEnabled: widget.initialZoomControlsEnabled, + cameraTargetBounds: widget.initialCameraTargetBounds, + ), + ), + onMapReady: _onPlatformViewCreated); + } + + /// Callback method when platform view is created. + void _onPlatformViewCreated(int viewId) { + initMapViewListeners(viewId); + + final GoogleMapViewController viewController = + GoogleMapViewController(viewId); + widget.onViewCreated(viewController); + } +} diff --git a/lib/src/google_maps_map_view_controller.dart b/lib/src/google_maps_map_view_controller.dart new file mode 100644 index 0000000..fa1604b --- /dev/null +++ b/lib/src/google_maps_map_view_controller.dart @@ -0,0 +1,366 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import '../google_navigation_flutter.dart'; +import 'google_navigation_flutter_platform_interface.dart'; + +/// Map View Controller class to handle map view events. +/// {@category Map View} +class GoogleMapViewController { + /// Basic constructor. + /// + /// Don't create this directly, but access through + /// [GoogleMapsMapView.onViewCreated] callback. + GoogleMapViewController(this._viewId) + : settings = NavigationViewUISettings(_viewId); + + final int _viewId; + + /// Settings for the user interface of the map. + final NavigationViewUISettings settings; + + /// Getter for view ID. + int getViewId() { + return _viewId; + } + + /// Change status of my location enabled. + /// + Future setMyLocationEnabled(bool enabled) { + return GoogleMapsNavigationPlatform.instance + .setMyLocationEnabled(viewId: _viewId, enabled: enabled); + } + + /// This method returns the current map type of the Google Maps view instance. + Future getMapType() { + return GoogleMapsNavigationPlatform.instance.getMapType(viewId: _viewId); + } + + /// Changes the type of the map being displayed on the Google Maps view. + /// + /// The [mapType] parameter specifies the new map type to be set. + /// It should be one of the values defined in the [MapType] enum, + /// such as [MapType.normal], [MapType.satellite], [MapType.terrain], + /// or [MapType.hybrid]. + /// + /// Example usage: + /// ```dart + /// _mapViewController.changeMapType(MapType.satellite); + /// ``` + Future setMapType({required MapType mapType}) async { + return GoogleMapsNavigationPlatform.instance + .setMapType(viewId: _viewId, mapType: mapType); + } + + /// Sets the styling of the base map using a string containing JSON. + /// Null value will reset the base map to default style. + /// If [styleJson] is invalid throws [MapStyleException]. + /// + /// For more details see the official documentation: + /// https://developers.google.com/maps/documentation/ios-sdk/styling + /// https://developers.google.com/maps/documentation/android-sdk/styling + Future setMapStyle(String? styleJson) async { + return GoogleMapsNavigationPlatform.instance + .setMapStyle(_viewId, styleJson); + } + + /// Gets whether the my location is enabled or disabled. + /// + Future isMyLocationEnabled() async { + return GoogleMapsNavigationPlatform.instance + .isMyLocationEnabled(viewId: _viewId); + } + + /// Ask the camera to follow the user's location. + /// + /// Use [perspective] to specify the orientation of the camera + /// and optional [zoomLevel] to control the map zoom. + Future followMyLocation(CameraPerspective perspective, + {double? zoomLevel}) async { + return GoogleMapsNavigationPlatform.instance.followMyLocation( + viewId: _viewId, perspective: perspective, zoomLevel: zoomLevel); + } + + /// Gets user's current location. + Future getMyLocation() async { + return GoogleMapsNavigationPlatform.instance.getMyLocation(viewId: _viewId); + } + + /// Gets the current visible map region or camera bounds. + Future getVisibleRegion() async { + return GoogleMapsNavigationPlatform.instance + .getVisibleRegion(viewId: _viewId); + } + + /// Gets the current position of the camera. + Future getCameraPosition() async { + return GoogleMapsNavigationPlatform.instance + .getCameraPosition(viewId: _viewId); + } + + /// Animates the movement of the camera from the current position + /// to the position defined in the [cameraUpdate]. + /// + /// See [CameraUpdate] for more information on how to create different camera + /// animations. + /// + /// On Android you can override the default animation [duration] and + /// set [onFinished] callback that is called when the animation completes + /// (passes true) or is cancelled (passes false). + /// + /// Example usage: + /// ```dart + /// controller.animateCamera(CameraUpdate.zoomIn(), + /// duration: Duration(milliseconds: 600), + /// onFinished: (bool success) => {}); + /// ``` + /// On iOS [duration] and [onFinished] are not supported and defining them + /// does nothing. + /// + /// See also [moveCamera], [followMyLocation]. + Future animateCamera(CameraUpdate cameraUpdate, + {Duration? duration, AnimationFinishedCallback? onFinished}) { + return GoogleMapsNavigationPlatform.instance.animateCamera( + viewId: _viewId, + cameraUpdate: cameraUpdate, + duration: duration?.inMilliseconds, + onFinished: onFinished); + } + + /// Moves the camera from the current position to the position + /// defined in the [cameraUpdate]. + /// + /// See [CameraUpdate] for more information + /// on how to create different camera movements. + Future moveCamera(CameraUpdate cameraUpdate) { + return GoogleMapsNavigationPlatform.instance + .moveCamera(viewId: _viewId, cameraUpdate: cameraUpdate); + } + + /// Is the recenter button enabled. + Future isRecenterButtonEnabled() { + return GoogleMapsNavigationPlatform.instance + .isRecenterButtonEnabled(viewId: _viewId); + } + + /// Enable or disable the recenter button. + /// + /// By default, the recenter button is enabled. + Future setRecenterButtonEnabled(bool enabled) { + return GoogleMapsNavigationPlatform.instance.setRecenterButtonEnabled( + viewId: _viewId, + enabled: enabled, + ); + } + + /// Returns the minimum zoom level preference from the map view. + /// If minimum zoom preference is not set previously, returns minimum possible + /// zoom level for the current map type. + Future getMinZoomPreference() { + return GoogleMapsNavigationPlatform.instance + .getMinZoomPreference(viewId: _viewId); + } + + /// Returns the maximum zoom level preference from the map view. + /// If maximum zoom preference is not set previously, returns maximum possible + /// zoom level for the current map type. + Future getMaxZoomPreference() { + return GoogleMapsNavigationPlatform.instance + .getMaxZoomPreference(viewId: _viewId); + } + + /// Removes any previously specified upper and lower zoom bounds. + Future resetMinMaxZoomPreference() { + return GoogleMapsNavigationPlatform.instance + .resetMinMaxZoomPreference(viewId: _viewId); + } + + /// Sets a preferred lower bound for the camera zoom. + /// + /// When the minimum zoom changes, the SDK adjusts all later camera updates + /// to respect that minimum if possible. Note that there are technical + /// considerations that may prevent the SDK from allowing users to zoom too low. + /// + /// Throws [MinZoomRangeException] if [minZoomPreference] is + /// greater than maximum zoom lavel. + Future setMinZoomPreference(double minZoomPreference) { + return GoogleMapsNavigationPlatform.instance.setMinZoomPreference( + viewId: _viewId, minZoomPreference: minZoomPreference); + } + + /// Sets a preferred upper bound for the camera zoom. + /// + /// When the maximum zoom changes, the SDK adjusts all later camera updates + /// to respect that maximum if possible. Note that there are technical + /// considerations that may prevent the SDK from allowing users to zoom too + /// deep into the map. For example, satellite or terrain may have a lower + /// maximum zoom than the base map tiles. + /// + /// Throws [MaxZoomRangeException] if [maxZoomPreference] is + /// less than minimum zoom lavel. + Future setMaxZoomPreference(double maxZoomPreference) { + return GoogleMapsNavigationPlatform.instance.setMaxZoomPreference( + viewId: _viewId, maxZoomPreference: maxZoomPreference); + } + + /// Retrieves all markers that have been added to the map view. + Future> getMarkers() { + return GoogleMapsNavigationPlatform.instance.getMarkers(viewId: _viewId); + } + + /// Add markers to the map view. + Future> addMarkers(List markerOptions) { + return GoogleMapsNavigationPlatform.instance + .addMarkers(viewId: _viewId, markerOptions: markerOptions); + } + + /// Update markers to the map view. + /// + /// Throws [MarkerNotFoundException] if the [markers] list contains one or + /// more markers that have not been added to the map view via [addMarkers] or + /// contains markers that have already been removed from the map view. + Future> updateMarkers(List markers) async { + return GoogleMapsNavigationPlatform.instance + .updateMarkers(viewId: _viewId, markers: markers); + } + + /// Remove markers from the map view. + /// + /// Throws [MarkerNotFoundException] if the [markers] list contains one or + /// more markers that have not been added to the map view via [addMarkers] or + /// contains markers that have already been removed from the map view. + Future removeMarkers(List markers) async { + return GoogleMapsNavigationPlatform.instance + .removeMarkers(viewId: _viewId, markers: markers); + } + + /// Remove all markers from the map view. + Future clearMarkers() { + return GoogleMapsNavigationPlatform.instance.clearMarkers(viewId: _viewId); + } + + /// Retrieves all polygons that have been added to the map view. + Future> getPolygons() { + return GoogleMapsNavigationPlatform.instance.getPolygons(viewId: _viewId); + } + + /// Add polygons to the map view. + Future> addPolygons(List polygonOptions) { + return GoogleMapsNavigationPlatform.instance + .addPolygons(viewId: _viewId, polygonOptions: polygonOptions); + } + + /// Update polygons to the map view. + /// + /// Throws [PolygonNotFoundException] if the [polygons] list contains + /// polygon that has not beed added to the map view via [addPolygons] or + /// contains polygon that has already been removed from the map view. + Future> updatePolygons(List polygons) async { + return GoogleMapsNavigationPlatform.instance + .updatePolygons(viewId: _viewId, polygons: polygons); + } + + /// Remove polygons from the map view. + /// + /// Throws [PolygonNotFoundException] if the [polygons] list contains + /// polygon that has not beed added to the map view via [addPolygons] or + /// contains polygon that has already been removed from the map view. + Future removePolygons(List polygons) async { + return GoogleMapsNavigationPlatform.instance + .removePolygons(viewId: _viewId, polygons: polygons); + } + + /// Remove all polygons from the map view. + Future clearPolygons() { + return GoogleMapsNavigationPlatform.instance.clearPolygons(viewId: _viewId); + } + + /// Retrieves all polylines that have been added to the map view. + Future> getPolylines() { + return GoogleMapsNavigationPlatform.instance.getPolylines(viewId: _viewId); + } + + /// Add polylines to the map view. + Future> addPolylines(List polylineOptions) { + return GoogleMapsNavigationPlatform.instance + .addPolylines(viewId: _viewId, polylineOptions: polylineOptions); + } + + /// Update polylines to the map view. + /// + /// Throws [PolylineNotFoundException] if the [polylines] list contains + /// polyline that has not beed added to the map view via [addPolylines] or + /// contains polyline that has already been removed from the map view. + Future> updatePolylines(List polylines) async { + return GoogleMapsNavigationPlatform.instance + .updatePolylines(viewId: _viewId, polylines: polylines); + } + + /// Remove polylines from the map view. + /// + /// Throws [PolylineNotFoundException] if the [polylines] list contains + /// polyline that has not beed added to the map view via [addPolylines] or + /// contains polyline that has already been removed from the map view. + Future removePolylines(List polylines) async { + return GoogleMapsNavigationPlatform.instance + .removePolylines(viewId: _viewId, polylines: polylines); + } + + /// Remove all polylines from the map view. + Future clearPolylines() { + return GoogleMapsNavigationPlatform.instance + .clearPolylines(viewId: _viewId); + } + + /// Gets all circles from the map view. + Future> getCircles() { + return GoogleMapsNavigationPlatform.instance.getCircles(viewId: _viewId); + } + + /// Add circles to the map view. + Future> addCircles(List options) { + return GoogleMapsNavigationPlatform.instance + .addCircles(viewId: _viewId, options: options); + } + + /// Update circles to the map view. + /// + /// Throws [CircleNotFoundException] if the [circles] list contains one or + /// more circles that have not been added to the map view via [addCircles] or + /// contains circles that have already been removed from the map view. + Future> updateCircles(List circles) async { + return GoogleMapsNavigationPlatform.instance + .updateCircles(viewId: _viewId, circles: circles); + } + + /// Remove circles from the map view. + /// + /// Throws [CircleNotFoundException] if the [circles] list contains one or + /// more circles that have not been added to the map view via [addCircles] or + /// contains circles that have already been removed from the map view. + Future removeCircles(List circles) async { + return GoogleMapsNavigationPlatform.instance + .removeCircles(viewId: _viewId, circles: circles); + } + + /// Remove all circles from the map view. + Future clearCircles() { + return GoogleMapsNavigationPlatform.instance.clearCircles(viewId: _viewId); + } + + /// Remove all markers, polylines, polygons, overlays, etc from the map view. + Future clear() { + return GoogleMapsNavigationPlatform.instance.clear(viewId: _viewId); + } +} diff --git a/lib/src/google_maps_navigation_view.dart b/lib/src/google_maps_navigation_view.dart new file mode 100644 index 0000000..f68ac66 --- /dev/null +++ b/lib/src/google_maps_navigation_view.dart @@ -0,0 +1,208 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; + +import '../google_navigation_flutter.dart'; +import 'google_navigation_flutter_platform_interface.dart'; + +/// On Google Navigation view created callback. +typedef OnNavigationViewCreatedCallback = void Function( + GoogleNavigationViewController controller, +); + +/// The main map view widget for Google Maps Navigation. +/// {@category Navigation View} +class GoogleMapsNavigationView extends GoogleMapsBaseMapView { + /// The main widget for embedding Google Maps Navigation into a Flutter application. + /// + /// After creating the map view, the [onViewCreated] callback is triggered, providing a + /// [GoogleNavigationViewController] that you can use to interact with the map programmatically. + /// + /// Example usage: + /// ```dart + /// GoogleMapsNavigationView( + /// onViewCreated: (controller) { + /// // Use the controller to interact with the map. + /// }, + /// initialCameraPosition: CameraPosition( + /// // Initial camera position parameters + /// ), + /// // Other initial map settings... + /// ) + /// ``` + const GoogleMapsNavigationView( + {super.key, + required this.onViewCreated, + super.initialCameraPosition = const CameraPosition(), + super.initialMapType = MapType.normal, + super.initialCompassEnabled = true, + super.initialRotateGesturesEnabled = true, + super.initialScrollGesturesEnabled = true, + super.initialTiltGesturesEnabled = true, + super.initialZoomGesturesEnabled = true, + super.initialScrollGesturesEnabledDuringRotateOrZoom = true, + super.initialMapToolbarEnabled = true, + super.initialMinZoomPreference, + super.initialMaxZoomPreference, + super.initialZoomControlsEnabled = true, + super.initialCameraTargetBounds, + this.initialNavigationUIEnabledPreference = + NavigationUIEnabledPreference.automatic, + super.layoutDirection, + super.gestureRecognizers = + const >{}, + super.onRecenterButtonClicked, + super.onMarkerClicked, + super.onMarkerDrag, + super.onMarkerDragStart, + super.onMarkerDragEnd, + super.onMarkerInfoWindowClicked, + super.onMarkerInfoWindowClosed, + super.onMarkerInfoWindowLongClicked, + super.onMapClicked, + super.onMapLongClicked, + super.onPolygonClicked, + super.onPolylineClicked, + super.onCircleClicked, + this.onNavigationUIEnabledChanged, + super.onMyLocationClicked, + super.onMyLocationButtonClicked, + super.onCameraMoveStarted, + super.onCameraMove, + super.onCameraIdle, + super.onCameraStartedFollowingLocation, + super.onCameraStoppedFollowingLocation}); + + /// On view created callback. + final OnNavigationViewCreatedCallback onViewCreated; + + /// Determines the initial visibility of the navigation UI on map initialization. + /// + /// By default set to [NavigationUIEnabledPreference.automatic], + /// meaning the navigation UI gets enabled if the navigation + /// session has already been successfully started. + /// + /// If set to [NavigationUIEnabledPreference.disabled] the navigation view + /// initially displays a classic map view. + /// + /// Note on Android enabling the navigation UI for the view requires that the + /// navigation session has already been successfully started with + /// [GoogleMapsNavigator.initializeNavigationSession]. On iOS accepting + /// the terms and conditions is enough. + final NavigationUIEnabledPreference initialNavigationUIEnabledPreference; + + /// On navigation UI enabled changed callback. + final OnNavigationUIEnabledChanged? onNavigationUIEnabledChanged; + + /// Creates a [State] for this [GoogleMapsNavigationView]. + @override + State createState() => GoogleMapsNavigationViewState(); +} + +/// Google Maps Navigation. +/// {@category Navigation View} +class GoogleMapsNavigationViewState + extends MapViewState { + @override + Widget build(BuildContext context) { + return GoogleMapsNavigationPlatform.instance.buildNavigationView( + initializationOptions: MapViewInitializationOptions( + layoutDirection: widget.layoutDirection ?? + Directionality.maybeOf(context) ?? + TextDirection.ltr, + gestureRecognizers: widget.gestureRecognizers, + mapOptions: MapOptions( + cameraPosition: widget.initialCameraPosition, + mapType: widget.initialMapType, + compassEnabled: widget.initialCompassEnabled, + rotateGesturesEnabled: widget.initialRotateGesturesEnabled, + scrollGesturesEnabled: widget.initialScrollGesturesEnabled, + tiltGesturesEnabled: widget.initialTiltGesturesEnabled, + zoomGesturesEnabled: widget.initialZoomGesturesEnabled, + scrollGesturesEnabledDuringRotateOrZoom: + widget.initialScrollGesturesEnabledDuringRotateOrZoom, + mapToolbarEnabled: widget.initialMapToolbarEnabled, + minZoomPreference: widget.initialMinZoomPreference, + maxZoomPreference: widget.initialMaxZoomPreference, + zoomControlsEnabled: widget.initialZoomControlsEnabled, + cameraTargetBounds: widget.initialCameraTargetBounds, + ), + navigationViewOptions: NavigationViewOptions( + navigationUIEnabledPreference: + widget.initialNavigationUIEnabledPreference)), + onMapReady: _onPlatformViewCreated); + } + + /// Callback method when platform view is created. + void _onPlatformViewCreated(int viewId) { + initMapViewListeners(viewId); + _initNavigationViewListeners(viewId); + final GoogleNavigationViewController viewController = + GoogleNavigationViewController(viewId); + widget.onViewCreated(viewController); + } + + void _initNavigationViewListeners(int viewId) { + if (widget.onRecenterButtonClicked != null) { + GoogleMapsNavigationPlatform.instance + .getNavigationRecenterButtonClickedEventStream(viewId: viewId) + .listen(widget.onRecenterButtonClicked); + } + if (widget.onMyLocationClicked != null) { + GoogleMapsNavigationPlatform.instance + .getMyLocationClickedEventStream(viewId: viewId) + .listen(widget.onMyLocationClicked); + } + if (widget.onNavigationUIEnabledChanged != null) { + GoogleMapsNavigationPlatform.instance + .getNavigationUIEnabledChangedEventStream(viewId: viewId) + .listen((NavigationUIEnabledChangedEvent event) { + widget.onNavigationUIEnabledChanged?.call(event.navigationUIEnabled); + }); + } + if (widget.onMyLocationButtonClicked != null) { + GoogleMapsNavigationPlatform.instance + .getMyLocationButtonClickedEventStream(viewId: viewId) + .listen(widget.onMyLocationButtonClicked); + } + if (widget.onCameraMoveStarted != null || + widget.onCameraMove != null || + widget.onCameraIdle != null) { + GoogleMapsNavigationPlatform.instance + .registerOnCameraChangedListener(viewId: viewId); + } + + GoogleMapsNavigationPlatform.instance + .getCameraChangedEventStream(viewId: viewId) + .listen((CameraChangedEvent event) { + switch (event.eventType) { + case CameraEventType.moveStartedByApi: + widget.onCameraMoveStarted?.call(event.position, false); + case CameraEventType.moveStartedByGesture: + widget.onCameraMoveStarted?.call(event.position, true); + case CameraEventType.onCameraMove: + widget.onCameraMove?.call(event.position); + case CameraEventType.onCameraIdle: + widget.onCameraIdle?.call(event.position); + case CameraEventType.onCameraStartedFollowingLocation: + widget.onCameraStartedFollowingLocation?.call(event.position); + case CameraEventType.onCameraStoppedFollowingLocation: + widget.onCameraStoppedFollowingLocation?.call(event.position); + } + }); + } +} diff --git a/lib/src/google_maps_navigation_view_controller.dart b/lib/src/google_maps_navigation_view_controller.dart new file mode 100644 index 0000000..36c493f --- /dev/null +++ b/lib/src/google_maps_navigation_view_controller.dart @@ -0,0 +1,159 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import '../google_navigation_flutter.dart'; +import 'google_navigation_flutter_platform_interface.dart'; + +/// Navigation View Controller class to handle navigation view events. +/// {@category Navigation View} +class GoogleNavigationViewController extends GoogleMapViewController { + /// Basic constructor. + /// + /// Don't create this directly, but access through + /// [GoogleMapsNavigationView.onViewCreated] callback. + GoogleNavigationViewController(super.viewId); + + /// Is the navigation trip progress bar enabled. + Future isNavigationTripProgressBarEnabled() { + return GoogleMapsNavigationPlatform.instance + .isNavigationTripProgressBarEnabled(viewId: getViewId()); + } + + /// Enable or disable the navigation trip progress bar. + /// + /// By default, the navigation trip progress bar is disabled. + Future setNavigationTripProgressBarEnabled(bool enabled) { + return GoogleMapsNavigationPlatform.instance + .setNavigationTripProgressBarEnabled( + viewId: getViewId(), + enabled: enabled, + ); + } + + /// Is the navigation header enabled. + Future isNavigationHeaderEnabled() { + return GoogleMapsNavigationPlatform.instance + .isNavigationHeaderEnabled(viewId: getViewId()); + } + + /// Enable or disable the navigation header. + /// + /// By default, the navigation header is enabled. + Future setNavigationHeaderEnabled(bool enabled) { + return GoogleMapsNavigationPlatform.instance.setNavigationHeaderEnabled( + viewId: getViewId(), + enabled: enabled, + ); + } + + /// Is the navigation footer enabled. + Future isNavigationFooterEnabled() { + return GoogleMapsNavigationPlatform.instance + .isNavigationFooterEnabled(viewId: getViewId()); + } + + /// Enable or disable the navigation footer. + /// + /// By default, the navigation footer is enabled. + /// + /// Also known as ETA card, for example in Android + /// calls [setEtaCardEnabled().](https://developers.google.com/maps/documentation/navigation/android-sdk/v1/reference/com/google/android/libraries/navigation/NavigationView#setEtaCardEnabled(boolean)) + Future setNavigationFooterEnabled(bool enabled) { + return GoogleMapsNavigationPlatform.instance.setNavigationFooterEnabled( + viewId: getViewId(), + enabled: enabled, + ); + } + + /// Can the speed limit indication be displayed. + Future isSpeedLimitIconEnabled() { + return GoogleMapsNavigationPlatform.instance + .isSpeedLimitIconEnabled(viewId: getViewId()); + } + + /// Allow showing the speed limit indicator. + /// + /// By default, the speed limit is not displayed. + Future setSpeedLimitIconEnabled(bool enabled) { + return GoogleMapsNavigationPlatform.instance.setSpeedLimitIconEnabled( + viewId: getViewId(), + enabled: enabled, + ); + } + + /// Can the speedometer be displayed. + Future isSpeedometerEnabled() { + return GoogleMapsNavigationPlatform.instance + .isSpeedometerEnabled(viewId: getViewId()); + } + + /// Allow showing the speedometer. + /// + /// By default, the speedometer is not displayed. + Future setSpeedometerEnabled(bool enabled) { + return GoogleMapsNavigationPlatform.instance.setSpeedometerEnabled( + viewId: getViewId(), + enabled: enabled, + ); + } + + /// Are the incident cards displayed. + Future isTrafficIncidentCardsEnabled() { + return GoogleMapsNavigationPlatform.instance + .isTrafficIncidentCardsEnabled(viewId: getViewId()); + } + + /// Enable or disable showing of the incident cards. + /// + /// By default, the incident cards are shown. + Future setTrafficIncidentCardsEnabled(bool enabled) { + return GoogleMapsNavigationPlatform.instance.setTrafficIncidentCardsEnabled( + viewId: getViewId(), + enabled: enabled, + ); + } + + /// Check if the navigation user interface is shown. + Future isNavigationUIEnabled() { + return GoogleMapsNavigationPlatform.instance + .isNavigationUIEnabled(viewId: getViewId()); + } + + /// Show or hide the navigation user interface shown on top of the map. + /// + /// When enabled also actives [followMyLocation] camera mode. + /// + /// Disabling hides routes on iOS, but on Android the routes stay visible. + /// + /// By default, the navigation UI is enabled when the session has been + /// initialized with [GoogleMapsNavigator.initializeNavigationSession]. + /// + /// Fails on Android if the navigation session has not been initialized, + /// and on iOS if the terms and conditions have not been accepted. + Future setNavigationUIEnabled(bool enabled) { + return GoogleMapsNavigationPlatform.instance.setNavigationUIEnabled( + viewId: getViewId(), + enabled: enabled, + ); + } + + /// Move the map camera to show the route overview. + /// + /// See also [followMyLocation] and [animateCamera]. + Future showRouteOverview() { + return GoogleMapsNavigationPlatform.instance.showRouteOverview( + viewId: getViewId(), + ); + } +} diff --git a/lib/src/google_navigation_flutter.dart b/lib/src/google_navigation_flutter.dart index 029d0bb..83369d0 100644 --- a/lib/src/google_navigation_flutter.dart +++ b/lib/src/google_navigation_flutter.dart @@ -14,18 +14,9 @@ import 'dart:async'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; - import '../google_navigation_flutter.dart'; import 'google_navigation_flutter_platform_interface.dart'; -/// The view creation callback. -typedef OnCreatedCallback = void Function( - GoogleNavigationViewController controller, -); - /// Called during speeding event. typedef OnSpeedingUpdatedEventCallback = void Function( SpeedingUpdatedEvent onSpeedingUpdatedEvent, @@ -163,285 +154,9 @@ typedef OnCameraStartedFollowingLocation = void Function( typedef OnCameraStoppedFollowingLocation = void Function( CameraPosition position); -/// The main map view widget for Google Maps Navigation. -/// {@category Navigation View} -class GoogleMapsNavigationView extends StatefulWidget { - /// The main widget for embedding Google Maps Navigation into a Flutter application. - /// - /// After creating the map view, the [onViewCreated] callback is triggered, providing a - /// [GoogleNavigationViewController] that you can use to interact with the map programmatically. - /// - /// Example usage: - /// ```dart - /// GoogleMapsNavigationView( - /// onViewCreated: (controller) { - /// // Use the controller to interact with the map. - /// }, - /// initialCameraPosition: CameraPosition( - /// // Initial camera position parameters - /// ), - /// // Other initial map settings... - /// ) - /// ``` - const GoogleMapsNavigationView( - {super.key, - required this.onViewCreated, - this.initialCameraPosition = const CameraPosition(), - this.initialMapType = MapType.normal, - this.initialCompassEnabled = true, - this.initialRotateGesturesEnabled = true, - this.initialScrollGesturesEnabled = true, - this.initialTiltGesturesEnabled = true, - this.initialZoomGesturesEnabled = true, - this.initialScrollGesturesEnabledDuringRotateOrZoom = true, - this.initialMapToolbarEnabled = true, - this.initialMinZoomPreference, - this.initialMaxZoomPreference, - this.initialZoomControlsEnabled = true, - this.initialCameraTargetBounds, - this.initialNavigationUIEnabledPreference = - NavigationUIEnabledPreference.automatic, - this.layoutDirection, - this.gestureRecognizers = const >{}, - this.onRecenterButtonClicked, - this.onMarkerClicked, - this.onMarkerDrag, - this.onMarkerDragStart, - this.onMarkerDragEnd, - this.onMarkerInfoWindowClicked, - this.onMarkerInfoWindowClosed, - this.onMarkerInfoWindowLongClicked, - this.onMapClicked, - this.onMapLongClicked, - this.onPolygonClicked, - this.onPolylineClicked, - this.onCircleClicked, - this.onNavigationUIEnabledChanged, - this.onMyLocationClicked, - this.onMyLocationButtonClicked, - this.onCameraMoveStarted, - this.onCameraMove, - this.onCameraIdle, - this.onCameraStartedFollowingLocation, - this.onCameraStoppedFollowingLocation}); - - /// On view created callback. - final OnCreatedCallback onViewCreated; - - /// The initial positioning of the camera in the map view. - final CameraPosition initialCameraPosition; - - /// The directionality to be used for text layout within the embedded view. - final TextDirection? layoutDirection; - - /// The type of map to display, specified using [MapType] enum values. - final MapType initialMapType; - - /// Specifies whether the compass should be enabled. - /// - /// The compass is an icon on the map that indicates the direction of north on the map. - /// If enabled, it is only shown when the camera is tilted or rotated away from - /// its default orientation (tilt of 0 and a bearing of 0). - /// - /// By default, the compass is enabled. - final bool initialCompassEnabled; - - /// Specifies whether rotate gestures should be enabled. - /// - /// If enabled, users can use a two-finger rotate gesture to rotate the camera. - /// If disabled, users cannot rotate the camera via gestures. - /// This setting doesn't restrict the user from tapping the compass icon to reset the camera orientation, - /// nor does it restrict programmatic movements and animation of the camera. - /// - /// By default, the rotation gestures are enabled. - final bool initialRotateGesturesEnabled; - - /// Specifies whether scroll gestures should be enabled. - /// - /// By default, the scroll gestures are enabled. - final bool initialScrollGesturesEnabled; - - /// Specifies whether tilt gestures should be enabled. - /// - /// By default, the tilt gestures are enabled. - final bool initialTiltGesturesEnabled; - - /// Specifies whether zoom gestures should be enabled. - /// - /// By default, the zoom gestures enabled. - final bool initialZoomGesturesEnabled; - - /// Specifies whether scroll gestures during rotate or zoom should be enabled. - /// - /// If enabled, users can swipe to pan the camera. If disabled, swiping has no effect. - /// This setting doesn't restrict programmatic movement and animation of the camera. - /// - /// By default, the zoom gestures enabled. - final bool initialScrollGesturesEnabledDuringRotateOrZoom; - - /// Specifies whether the map toolbar should be enabled. Only applicable on Android. - /// - /// If enabled, and the map toolbar can be shown in the current context, - /// users will see a bar with various context-dependent actions. - /// - /// By default, the map toolbar is enabled. - final bool initialMapToolbarEnabled; - - /// Specifies a preferred lower bound for camera zoom. - /// - /// Null by default (not limited). - final double? initialMinZoomPreference; - - /// Specifies a preferred upper bound for camera zoom. - /// - /// Null by default (not limited). - final double? initialMaxZoomPreference; - - /// Specifies whether the zoom controls should be enabled. Only applicable on Android. - /// - /// By default, the zoom controls are enabled. - final bool initialZoomControlsEnabled; - - /// Specifies a bounds to constrain the camera target, so that when users scroll and pan the map, - /// the camera target does not move outside these bounds. - /// - /// Null by default (unbounded). - final LatLngBounds? initialCameraTargetBounds; - - /// Determines the initial visibility of the navigation UI on map initialization. - /// - /// By default set to [NavigationUIEnabledPreference.automatic], - /// meaning the navigation UI gets enabled if the navigation - /// session has already been successfully started. - /// - /// If set to [NavigationUIEnabledPreference.disabled] the navigation view - /// initially displays a classic map view. - /// - /// Note on Android enabling the navigation UI for the view requires that the - /// navigation session has already been successfully started with - /// [GoogleMapsNavigator.initializeNavigationSession]. On iOS accepting - /// the terms and conditions is enough. - final NavigationUIEnabledPreference initialNavigationUIEnabledPreference; - - /// Which gestures should be forwarded to the PlatformView. - /// - /// When this set is empty, the map will only handle pointer events for gestures that - /// were not claimed by any other gesture recognizer. - /// - /// See [PlatformViewSurface.gestureRecognizers] for details. - final Set> gestureRecognizers; - - /// On recenter button clicked event callback. - final OnRecenterButtonClicked? onRecenterButtonClicked; - - /// On marker clicked callback. - final OnMarkerClicked? onMarkerClicked; - - /// On marker drag callback. - final OnMarkerDrag? onMarkerDrag; - - /// On marker drag start callback. - final OnMarkerDragStart? onMarkerDragStart; - - /// On marker drag end callback. - final OnMarkerDragEnd? onMarkerDragEnd; - - /// On marker info window clicked callback. - final OnMarkerInfoWindowClicked? onMarkerInfoWindowClicked; - - /// On marker info window closed callback. - final OnMarkerInfoWindowClosed? onMarkerInfoWindowClosed; - - /// On marker info window long clicked callback. - final OnMarkerInfoWindowLongClicked? onMarkerInfoWindowLongClicked; - - /// On map clicked callback. - final OnMapClicked? onMapClicked; - - /// On map long clicked callback. - final OnMapLongClicked? onMapLongClicked; - - /// On polygon clicked callback. - final OnPolygonClicked? onPolygonClicked; - - /// On polyline clicked callback. - final OnPolylineClicked? onPolylineClicked; - - /// On circle clicked callback. - final OnCircleClicked? onCircleClicked; - - /// On navigation UI enabled changed callback. - final OnNavigationUIEnabledChanged? onNavigationUIEnabledChanged; - - /// On my location clicked callback. - final OnMyLocationClicked? onMyLocationClicked; - - /// On my location button clicked callback. - final OnMyLocationButtonClicked? onMyLocationButtonClicked; - - /// On camera move started callback. - final OnCameraMoveStarted? onCameraMoveStarted; - - /// On camera move callback. - final OnCameraMove? onCameraMove; - - /// On camera idle callback. - final OnCameraIdle? onCameraIdle; - - /// On camera started following location callback (Android-only). - final OnCameraStartedFollowingLocation? onCameraStartedFollowingLocation; - - /// On camera stopped following location callback (Android-only). - final OnCameraStoppedFollowingLocation? onCameraStoppedFollowingLocation; - - /// Creates a [State] for this [GoogleMapsNavigationView]. - @override - State createState() => GoogleMapsNavigationViewState(); -} - -/// Google Maps Navigation. -/// {@category Navigation View} -class GoogleMapsNavigationViewState extends State { - @override - Widget build(BuildContext context) { - return GoogleMapsNavigationPlatform.instance.buildView( - initializationOptions: NavigationViewInitializationOptions( - layoutDirection: widget.layoutDirection ?? - Directionality.maybeOf(context) ?? - TextDirection.ltr, - gestureRecognizers: widget.gestureRecognizers, - mapOptions: MapOptions( - cameraPosition: widget.initialCameraPosition, - mapType: widget.initialMapType, - compassEnabled: widget.initialCompassEnabled, - rotateGesturesEnabled: widget.initialRotateGesturesEnabled, - scrollGesturesEnabled: widget.initialScrollGesturesEnabled, - tiltGesturesEnabled: widget.initialTiltGesturesEnabled, - zoomGesturesEnabled: widget.initialZoomGesturesEnabled, - scrollGesturesEnabledDuringRotateOrZoom: - widget.initialScrollGesturesEnabledDuringRotateOrZoom, - mapToolbarEnabled: widget.initialMapToolbarEnabled, - minZoomPreference: widget.initialMinZoomPreference, - maxZoomPreference: widget.initialMaxZoomPreference, - zoomControlsEnabled: widget.initialZoomControlsEnabled, - cameraTargetBounds: widget.initialCameraTargetBounds, - ), - navigationViewOptions: NavigationViewOptions( - navigationUIEnabledPreference: - widget.initialNavigationUIEnabledPreference)), - onMapReady: _onPlatformViewCreated); - } - - /// Callback method when platform view is created. - void _onPlatformViewCreated(int viewId) { - final GoogleNavigationViewController viewController = - GoogleNavigationViewController(viewId, this); - widget.onViewCreated(viewController); - } -} - /// Settings for the user interface of the map. /// {@category Navigation View} +/// {@category Map View} class NavigationViewUISettings { /// [NavigationViewUISettings] constructor. NavigationViewUISettings(this._viewId); @@ -624,691 +339,11 @@ class NavigationViewUISettings { } } -/// Navigation View Controller class to handle navigation view events. -/// {@category Navigation View} -class GoogleNavigationViewController { - /// Basic constructor. - /// - /// Don't create this directly, but access through - /// [GoogleMapsNavigationView.onViewCreated] callback. - GoogleNavigationViewController(this._viewId, [this._viewState]) - : settings = NavigationViewUISettings(_viewId) { - _initListeners(); - } - - final int _viewId; - - final GoogleMapsNavigationViewState? _viewState; - - /// Settings for the user interface of the map. - final NavigationViewUISettings settings; - - /// Getter for view ID. - int getViewId() { - return _viewId; - } - - /// Initializes the event channel listeners for the navigation view instance. - void _initListeners() { - _setOnMapClickedListeners(); - _setOnRecenterButtonClickedListener(); - _setOnMarkerClickedListeners(); - _setOnMarkerDragListeners(); - _setOnPolygonClickedListener(); - _setOnPolylineClickedListener(); - _setOnCircleClickedListener(); - _setOnNavigationUIEnabledChangedListener(); - _setOnMyLocationClickedListener(); - _setOnMyLocationButtonClickedListener(); - _setOnCameraChangedListener(); - } - - /// Sets the event channel listener for the map click event listeners. - void _setOnMapClickedListeners() { - if (_viewState != null) { - if (_viewState.widget.onMapClicked != null) { - GoogleMapsNavigationPlatform.instance - .getMapClickEventStream(viewId: _viewId) - .listen((MapClickEvent event) { - _viewState.widget.onMapClicked!(event.target); - }); - } - if (_viewState.widget.onMapLongClicked != null) { - GoogleMapsNavigationPlatform.instance - .getMapLongClickEventStream(viewId: _viewId) - .listen((MapLongClickEvent event) { - _viewState.widget.onMapLongClicked!(event.target); - }); - } - } - } - - /// Sets the event channel listener for the on recenter button clicked event. - void _setOnRecenterButtonClickedListener() { - if (_viewState != null && - _viewState.widget.onRecenterButtonClicked != null) { - GoogleMapsNavigationPlatform.instance - .getNavigationRecenterButtonClickedEventStream(viewId: _viewId) - .listen(_viewState.widget.onRecenterButtonClicked); - } - } - - /// Sets the event channel listener for the marker clicked events. - void _setOnMarkerClickedListeners() { - GoogleMapsNavigationPlatform.instance - .getMarkerEventStream(viewId: _viewId) - .listen((MarkerEvent event) { - switch (event.eventType) { - case MarkerEventType.clicked: - _viewState?.widget.onMarkerClicked?.call(event.markerId); - case MarkerEventType.infoWindowClicked: - _viewState?.widget.onMarkerInfoWindowClicked?.call(event.markerId); - case MarkerEventType.infoWindowClosed: - _viewState?.widget.onMarkerInfoWindowClosed?.call(event.markerId); - case MarkerEventType.infoWindowLongClicked: - _viewState?.widget.onMarkerInfoWindowLongClicked - ?.call(event.markerId); - } - }); - } - - /// Sets the event channel listener for the on my location clicked event. - void _setOnMyLocationClickedListener() { - if (_viewState != null && _viewState.widget.onMyLocationClicked != null) { - GoogleMapsNavigationPlatform.instance - .getMyLocationClickedEventStream(viewId: _viewId) - .listen(_viewState.widget.onMyLocationClicked); - } - } - - /// Sets the event channel listener for the on my location button clicked event. - void _setOnMyLocationButtonClickedListener() { - if (_viewState != null && - _viewState.widget.onMyLocationButtonClicked != null) { - GoogleMapsNavigationPlatform.instance - .getMyLocationButtonClickedEventStream(viewId: _viewId) - .listen(_viewState.widget.onMyLocationButtonClicked); - } - } - - /// Sets the event channel listener for camera changed events. - void _setOnCameraChangedListener() { - // Register listeners if any of the callbacks are not null. - if (_viewState?.widget.onCameraMoveStarted != null || - _viewState?.widget.onCameraMove != null || - _viewState?.widget.onCameraIdle != null) { - GoogleMapsNavigationPlatform.instance - .registerOnCameraChangedListener(viewId: _viewId); - } - GoogleMapsNavigationPlatform.instance - .getCameraChangedEventStream(viewId: _viewId) - .listen((CameraChangedEvent event) { - switch (event.eventType) { - case CameraEventType.moveStartedByApi: - _viewState?.widget.onCameraMoveStarted?.call(event.position, false); - case CameraEventType.moveStartedByGesture: - _viewState?.widget.onCameraMoveStarted?.call(event.position, true); - case CameraEventType.onCameraMove: - _viewState?.widget.onCameraMove?.call(event.position); - case CameraEventType.onCameraIdle: - _viewState?.widget.onCameraIdle?.call(event.position); - case CameraEventType.onCameraStartedFollowingLocation: - _viewState?.widget.onCameraStartedFollowingLocation - ?.call(event.position); - case CameraEventType.onCameraStoppedFollowingLocation: - _viewState?.widget.onCameraStoppedFollowingLocation - ?.call(event.position); - } - }); - } - - /// Sets the event channel listener for the marker drag event. - void _setOnMarkerDragListeners() { - GoogleMapsNavigationPlatform.instance - .getMarkerDragEventStream(viewId: _viewId) - .listen((MarkerDragEvent event) { - switch (event.eventType) { - case MarkerDragEventType.drag: - _viewState?.widget.onMarkerDrag?.call(event.markerId, event.position); - case MarkerDragEventType.dragEnd: - _viewState?.widget.onMarkerDragEnd - ?.call(event.markerId, event.position); - case MarkerDragEventType.dragStart: - _viewState?.widget.onMarkerDragStart - ?.call(event.markerId, event.position); - } - }); - } - - /// Sets the event channel listener for the polygon clicked event. - void _setOnPolygonClickedListener() { - GoogleMapsNavigationPlatform.instance - .getPolygonClickedEventStream(viewId: _viewId) - .listen((PolygonClickedEvent event) { - _viewState?.widget.onPolygonClicked?.call(event.polygonId); - }); - } - - /// Sets the event channel listener for the polyline clicked event. - void _setOnPolylineClickedListener() { - GoogleMapsNavigationPlatform.instance - .getPolylineClickedEventStream(viewId: _viewId) - .listen((PolylineClickedEvent event) { - _viewState?.widget.onPolylineClicked?.call(event.polylineId); - }); - } - - /// Sets the event channel listener for the circle clicked event. - void _setOnCircleClickedListener() { - GoogleMapsNavigationPlatform.instance - .getCircleClickedEventStream(viewId: _viewId) - .listen((CircleClickedEvent event) { - _viewState?.widget.onCircleClicked?.call(event.circleId); - }); - } - - /// Sets the event channel listener for the navigation UI enabled changed event. - void _setOnNavigationUIEnabledChangedListener() { - GoogleMapsNavigationPlatform.instance - .getNavigationUIEnabledChangedEventStream(viewId: _viewId) - .listen((NavigationUIEnabledChangedEvent event) { - _viewState?.widget.onNavigationUIEnabledChanged - ?.call(event.navigationUIEnabled); - }); - } - - /// Change status of my location enabled. - /// - /// By default, the my location layer is disabled, but gets - /// automatically enabled on Android when the navigation starts. - /// - /// On iOS this property doesn't control the my location indication during - /// the navigation. - Future setMyLocationEnabled(bool enabled) { - return GoogleMapsNavigationPlatform.instance - .setMyLocationEnabled(viewId: _viewId, enabled: enabled); - } - - /// This method returns the current map type of the Google Maps view instance. - Future getMapType() { - return GoogleMapsNavigationPlatform.instance.getMapType(viewId: _viewId); - } - - /// Changes the type of the map being displayed on the Google Maps view. - /// - /// The [mapType] parameter specifies the new map type to be set. - /// It should be one of the values defined in the [MapType] enum, - /// such as [MapType.normal], [MapType.satellite], [MapType.terrain], - /// or [MapType.hybrid]. - /// - /// MapType.terrain does not work during navigation. - /// - /// Example usage: - /// ```dart - /// _navigationViewController.changeMapType(MapType.satellite); - /// ``` - Future setMapType({required MapType mapType}) async { - return GoogleMapsNavigationPlatform.instance - .setMapType(viewId: _viewId, mapType: mapType); - } - - /// Sets the styling of the base map using a string containing JSON. - /// Null value will reset the base map to default style. - /// If [styleJson] is invalid throws [MapStyleException]. - /// - /// For more details see the official documentation: - /// https://developers.google.com/maps/documentation/ios-sdk/styling - /// https://developers.google.com/maps/documentation/android-sdk/styling - Future setMapStyle(String? styleJson) async { - return GoogleMapsNavigationPlatform.instance - .setMapStyle(_viewId, styleJson); - } - - /// Gets whether the my location is enabled or disabled. - /// - /// By default, the my location layer is disabled, but gets - /// automatically enabled on Android when the navigation starts. - /// - /// On iOS this property doesn't control the my location indication during - /// the navigation. - Future isMyLocationEnabled() async { - return GoogleMapsNavigationPlatform.instance - .isMyLocationEnabled(viewId: _viewId); - } - - /// Ask the camera to follow the user's location. - /// - /// Use [perspective] to specify the orientation of the camera - /// and optional [zoomLevel] to control the map zoom. - /// - /// Automatically started in the perspective [CameraPerspective.tilted] when - /// the navigation is initialized with [GoogleMapsNavigator.initializeNavigationSession] - /// or when navigation UI gets re-enabled with [setNavigationUIEnabled]. - /// - /// In Android, you can use [GoogleMapsNavigationView.onCameraStartedFollowingLocation] - /// and [GoogleMapsNavigationView.onCameraStoppedFollowingLocation] callbacks - /// to detect when the follow location mode is enabled or disabled. - /// - /// Note there are small differences on how Android and iOS handle the camera - /// during the follow my location mode (tilt, zoom, transitions, etc.). - /// - /// See also [GoogleMapsNavigator.startGuidance], [showRouteOverview] and [animateCamera]. - Future followMyLocation(CameraPerspective perspective, - {double? zoomLevel}) async { - return GoogleMapsNavigationPlatform.instance.followMyLocation( - viewId: _viewId, perspective: perspective, zoomLevel: zoomLevel); - } - - /// Gets user's current location. - Future getMyLocation() async { - return GoogleMapsNavigationPlatform.instance.getMyLocation(viewId: _viewId); - } - - /// Gets the current visible map region or camera bounds. - Future getVisibleRegion() async { - return GoogleMapsNavigationPlatform.instance - .getVisibleRegion(viewId: _viewId); - } - - /// Gets the current position of the camera. - Future getCameraPosition() async { - return GoogleMapsNavigationPlatform.instance - .getCameraPosition(viewId: _viewId); - } - - /// Animates the movement of the camera from the current position - /// to the position defined in the [cameraUpdate]. - /// - /// See [CameraUpdate] for more information on how to create different camera - /// animations. - /// - /// On Android you can override the default animation [duration] and - /// set [onFinished] callback that is called when the animation completes - /// (passes true) or is cancelled (passes false). - /// - /// Example usage: - /// ```dart - /// controller.animateCamera(CameraUpdate.zoomIn(), - /// duration: Duration(milliseconds: 600), - /// onFinished: (bool success) => {}); - /// ``` - /// On iOS [duration] and [onFinished] are not supported and defining them - /// does nothing. - /// - /// See also [moveCamera], [followMyLocation], [showRouteOverview]. - Future animateCamera(CameraUpdate cameraUpdate, - {Duration? duration, AnimationFinishedCallback? onFinished}) { - return GoogleMapsNavigationPlatform.instance.animateCamera( - viewId: _viewId, - cameraUpdate: cameraUpdate, - duration: duration?.inMilliseconds, - onFinished: onFinished); - } - - /// Moves the camera from the current position to the position - /// defined in the [cameraUpdate]. - /// - /// See [CameraUpdate] for more information - /// on how to create different camera movements. - Future moveCamera(CameraUpdate cameraUpdate) { - return GoogleMapsNavigationPlatform.instance - .moveCamera(viewId: _viewId, cameraUpdate: cameraUpdate); - } - - /// Is the navigation trip progress bar enabled. - Future isNavigationTripProgressBarEnabled() { - return GoogleMapsNavigationPlatform.instance - .isNavigationTripProgressBarEnabled(viewId: _viewId); - } - - /// Enable or disable the navigation trip progress bar. - /// - /// By default, the navigation trip progress bar is disabled. - Future setNavigationTripProgressBarEnabled(bool enabled) { - return GoogleMapsNavigationPlatform.instance - .setNavigationTripProgressBarEnabled( - viewId: _viewId, - enabled: enabled, - ); - } - - /// Is the navigation header enabled. - Future isNavigationHeaderEnabled() { - return GoogleMapsNavigationPlatform.instance - .isNavigationHeaderEnabled(viewId: _viewId); - } - - /// Enable or disable the navigation header. - /// - /// By default, the navigation header is enabled. - Future setNavigationHeaderEnabled(bool enabled) { - return GoogleMapsNavigationPlatform.instance.setNavigationHeaderEnabled( - viewId: _viewId, - enabled: enabled, - ); - } - - /// Is the navigation footer enabled. - Future isNavigationFooterEnabled() { - return GoogleMapsNavigationPlatform.instance - .isNavigationFooterEnabled(viewId: _viewId); - } - - /// Enable or disable the navigation footer. - /// - /// By default, the navigation footer is enabled. - /// - /// Also known as ETA card, for example in Android - /// calls [setEtaCardEnabled().](https://developers.google.com/maps/documentation/navigation/android-sdk/v1/reference/com/google/android/libraries/navigation/NavigationView#setEtaCardEnabled(boolean)) - Future setNavigationFooterEnabled(bool enabled) { - return GoogleMapsNavigationPlatform.instance.setNavigationFooterEnabled( - viewId: _viewId, - enabled: enabled, - ); - } - - /// Is the recenter button enabled. - Future isRecenterButtonEnabled() { - return GoogleMapsNavigationPlatform.instance - .isRecenterButtonEnabled(viewId: _viewId); - } - - /// Enable or disable the recenter button. - /// - /// By default, the recenter button is enabled. - Future setRecenterButtonEnabled(bool enabled) { - return GoogleMapsNavigationPlatform.instance.setRecenterButtonEnabled( - viewId: _viewId, - enabled: enabled, - ); - } - - /// Can the speed limit indication be displayed. - Future isSpeedLimitIconEnabled() { - return GoogleMapsNavigationPlatform.instance - .isSpeedLimitIconEnabled(viewId: _viewId); - } - - /// Allow showing the speed limit indicator. - /// - /// By default, the speed limit is not displayed. - Future setSpeedLimitIconEnabled(bool enabled) { - return GoogleMapsNavigationPlatform.instance.setSpeedLimitIconEnabled( - viewId: _viewId, - enabled: enabled, - ); - } - - /// Can the speedometer be displayed. - Future isSpeedometerEnabled() { - return GoogleMapsNavigationPlatform.instance - .isSpeedometerEnabled(viewId: _viewId); - } - - /// Allow showing the speedometer. - /// - /// By default, the speedometer is not displayed. - Future setSpeedometerEnabled(bool enabled) { - return GoogleMapsNavigationPlatform.instance.setSpeedometerEnabled( - viewId: _viewId, - enabled: enabled, - ); - } - - /// Are the incident cards displayed. - Future isTrafficIncidentCardsEnabled() { - return GoogleMapsNavigationPlatform.instance - .isTrafficIncidentCardsEnabled(viewId: _viewId); - } - - /// Enable or disable showing of the incident cards. - /// - /// By default, the incident cards are shown. - Future setTrafficIncidentCardsEnabled(bool enabled) { - return GoogleMapsNavigationPlatform.instance.setTrafficIncidentCardsEnabled( - viewId: _viewId, - enabled: enabled, - ); - } - - /// Check if the navigation user interface is shown. - Future isNavigationUIEnabled() { - return GoogleMapsNavigationPlatform.instance - .isNavigationUIEnabled(viewId: _viewId); - } - - /// Show or hide the navigation user interface shown on top of the map. - /// - /// When enabled also actives [followMyLocation] camera mode. - /// - /// Disabling hides routes on iOS, but on Android the routes stay visible. - /// - /// By default, the navigation UI is enabled when the session has been - /// initialized with [GoogleMapsNavigator.initializeNavigationSession]. - /// - /// Fails on Android if the navigation session has not been initialized, - /// and on iOS if the terms and conditions have not been accepted. - Future setNavigationUIEnabled(bool enabled) { - return GoogleMapsNavigationPlatform.instance.setNavigationUIEnabled( - viewId: _viewId, - enabled: enabled, - ); - } - - /// Move the map camera to show the route overview. - /// - /// See also [followMyLocation] and [animateCamera]. - Future showRouteOverview() { - return GoogleMapsNavigationPlatform.instance.showRouteOverview( - viewId: _viewId, - ); - } - - /// Returns the minimum zoom level preference from the map view. - /// If minimum zoom preference is not set previously, returns minimum possible - /// zoom level for the current map type. - Future getMinZoomPreference() { - return GoogleMapsNavigationPlatform.instance - .getMinZoomPreference(viewId: _viewId); - } - - /// Returns the maximum zoom level preference from the map view. - /// If maximum zoom preference is not set previously, returns maximum possible - /// zoom level for the current map type. - Future getMaxZoomPreference() { - return GoogleMapsNavigationPlatform.instance - .getMaxZoomPreference(viewId: _viewId); - } - - /// Removes any previously specified upper and lower zoom bounds. - Future resetMinMaxZoomPreference() { - return GoogleMapsNavigationPlatform.instance - .resetMinMaxZoomPreference(viewId: _viewId); - } - - /// Sets a preferred lower bound for the camera zoom. - /// - /// When the minimum zoom changes, the SDK adjusts all later camera updates - /// to respect that minimum if possible. Note that there are technical - /// considerations that may prevent the SDK from allowing users to zoom too low. - /// - /// Throws [MinZoomRangeException] if [minZoomPreference] is - /// greater than maximum zoom lavel. - Future setMinZoomPreference(double minZoomPreference) { - return GoogleMapsNavigationPlatform.instance.setMinZoomPreference( - viewId: _viewId, minZoomPreference: minZoomPreference); - } - - /// Sets a preferred upper bound for the camera zoom. - /// - /// When the maximum zoom changes, the SDK adjusts all later camera updates - /// to respect that maximum if possible. Note that there are technical - /// considerations that may prevent the SDK from allowing users to zoom too - /// deep into the map. For example, satellite or terrain may have a lower - /// maximum zoom than the base map tiles. - /// - /// Throws [MaxZoomRangeException] if [maxZoomPreference] is - /// less than minimum zoom lavel. - Future setMaxZoomPreference(double maxZoomPreference) { - return GoogleMapsNavigationPlatform.instance.setMaxZoomPreference( - viewId: _viewId, maxZoomPreference: maxZoomPreference); - } - - /// Retrieves all markers that have been added to the map view. - Future> getMarkers() { - return GoogleMapsNavigationPlatform.instance.getMarkers(viewId: _viewId); - } - - /// Add markers to the map view. - Future> addMarkers(List markerOptions) { - return GoogleMapsNavigationPlatform.instance - .addMarkers(viewId: _viewId, markerOptions: markerOptions); - } - - /// Update markers to the map view. - /// - /// Throws [MarkerNotFoundException] if the [markers] list contains one or - /// more markers that have not been added to the map view via [addMarkers] or - /// contains markers that have already been removed from the map view. - Future> updateMarkers(List markers) async { - return GoogleMapsNavigationPlatform.instance - .updateMarkers(viewId: _viewId, markers: markers); - } - - /// Remove markers from the map view. - /// - /// Throws [MarkerNotFoundException] if the [markers] list contains one or - /// more markers that have not been added to the map view via [addMarkers] or - /// contains markers that have already been removed from the map view. - Future removeMarkers(List markers) async { - return GoogleMapsNavigationPlatform.instance - .removeMarkers(viewId: _viewId, markers: markers); - } - - /// Remove all markers from the map view. - Future clearMarkers() { - return GoogleMapsNavigationPlatform.instance.clearMarkers(viewId: _viewId); - } - - /// Retrieves all polygons that have been added to the map view. - Future> getPolygons() { - return GoogleMapsNavigationPlatform.instance.getPolygons(viewId: _viewId); - } - - /// Add polygons to the map view. - Future> addPolygons(List polygonOptions) { - return GoogleMapsNavigationPlatform.instance - .addPolygons(viewId: _viewId, polygonOptions: polygonOptions); - } - - /// Update polygons to the map view. - /// - /// Throws [PolygonNotFoundException] if the [polygons] list contains - /// polygon that has not beed added to the map view via [addPolygons] or - /// contains polygon that has already been removed from the map view. - Future> updatePolygons(List polygons) async { - return GoogleMapsNavigationPlatform.instance - .updatePolygons(viewId: _viewId, polygons: polygons); - } - - /// Remove polygons from the map view. - /// - /// Throws [PolygonNotFoundException] if the [polygons] list contains - /// polygon that has not beed added to the map view via [addPolygons] or - /// contains polygon that has already been removed from the map view. - Future removePolygons(List polygons) async { - return GoogleMapsNavigationPlatform.instance - .removePolygons(viewId: _viewId, polygons: polygons); - } - - /// Remove all polygons from the map view. - Future clearPolygons() { - return GoogleMapsNavigationPlatform.instance.clearPolygons(viewId: _viewId); - } - - /// Retrieves all polylines that have been added to the map view. - Future> getPolylines() { - return GoogleMapsNavigationPlatform.instance.getPolylines(viewId: _viewId); - } - - /// Add polylines to the map view. - Future> addPolylines(List polylineOptions) { - return GoogleMapsNavigationPlatform.instance - .addPolylines(viewId: _viewId, polylineOptions: polylineOptions); - } - - /// Update polylines to the map view. - /// - /// Throws [PolylineNotFoundException] if the [polylines] list contains - /// polyline that has not beed added to the map view via [addPolylines] or - /// contains polyline that has already been removed from the map view. - Future> updatePolylines(List polylines) async { - return GoogleMapsNavigationPlatform.instance - .updatePolylines(viewId: _viewId, polylines: polylines); - } - - /// Remove polylines from the map view. - /// - /// Throws [PolylineNotFoundException] if the [polylines] list contains - /// polyline that has not beed added to the map view via [addPolylines] or - /// contains polyline that has already been removed from the map view. - Future removePolylines(List polylines) async { - return GoogleMapsNavigationPlatform.instance - .removePolylines(viewId: _viewId, polylines: polylines); - } - - /// Remove all polylines from the map view. - Future clearPolylines() { - return GoogleMapsNavigationPlatform.instance - .clearPolylines(viewId: _viewId); - } - - /// Gets all circles from the map view. - Future> getCircles() { - return GoogleMapsNavigationPlatform.instance.getCircles(viewId: _viewId); - } - - /// Add circles to the map view. - Future> addCircles(List options) { - return GoogleMapsNavigationPlatform.instance - .addCircles(viewId: _viewId, options: options); - } - - /// Update circles to the map view. - /// - /// Throws [CircleNotFoundException] if the [circles] list contains one or - /// more circles that have not been added to the map view via [addCircles] or - /// contains circles that have already been removed from the map view. - Future> updateCircles(List circles) async { - return GoogleMapsNavigationPlatform.instance - .updateCircles(viewId: _viewId, circles: circles); - } - - /// Remove circles from the map view. - /// - /// Throws [CircleNotFoundException] if the [circles] list contains one or - /// more circles that have not been added to the map view via [addCircles] or - /// contains circles that have already been removed from the map view. - Future removeCircles(List circles) async { - return GoogleMapsNavigationPlatform.instance - .removeCircles(viewId: _viewId, circles: circles); - } - - /// Remove all circles from the map view. - Future clearCircles() { - return GoogleMapsNavigationPlatform.instance.clearCircles(viewId: _viewId); - } - - /// Remove all markers, polylines, polygons, overlays, etc from the map view. - Future clear() { - return GoogleMapsNavigationPlatform.instance.clear(viewId: _viewId); - } -} - /// [GoogleNavigationViewController.updateMarkers] or /// [GoogleNavigationViewController.removeMarkers] failed /// to find the marker given to the method. /// {@category Navigation View} +/// {@category Map View} class MarkerNotFoundException implements Exception { /// Default constructor for [MarkerNotFoundException]. const MarkerNotFoundException(); @@ -1318,6 +353,7 @@ class MarkerNotFoundException implements Exception { /// [GoogleNavigationViewController.removePolygons] failed /// to find the polygon given to the method. /// {@category Navigation View} +/// {@category Map View} class PolygonNotFoundException implements Exception { /// Default constructor for [PolygonNotFoundException]. const PolygonNotFoundException(); @@ -1327,6 +363,7 @@ class PolygonNotFoundException implements Exception { /// [GoogleNavigationViewController.removePolylines] failed /// to find the polyline given to the method. /// {@category Navigation View} +/// {@category Map View} class PolylineNotFoundException implements Exception { /// Default constructor for [PolylineNotFoundException]. const PolylineNotFoundException(); @@ -1336,6 +373,7 @@ class PolylineNotFoundException implements Exception { /// [GoogleNavigationViewController.removeCircles] failed /// to find the circle given to the method. /// {@category Navigation View} +/// {@category Map View} class CircleNotFoundException implements Exception { /// Default constructor for [CircleNotFoundException]. const CircleNotFoundException(); @@ -1343,6 +381,7 @@ class CircleNotFoundException implements Exception { /// [GoogleNavigationViewController.setMapStyle] failed to set the map style. /// {@category Navigation View} +/// {@category Map View} class MapStyleException implements Exception { /// Default constructor for [MapStyleException]. const MapStyleException(); @@ -1350,6 +389,7 @@ class MapStyleException implements Exception { /// [GoogleNavigationViewController.setMaxZoomPreference] failed to set zoom level. /// {@category Navigation View} +/// {@category Map View} class MaxZoomRangeException implements Exception { /// Default constructor for [MaxZoomRangeException]. const MaxZoomRangeException(); @@ -1362,6 +402,7 @@ class MaxZoomRangeException implements Exception { /// [GoogleNavigationViewController.setMinZoomPreference] failed to set zoom level. /// {@category Navigation View} +/// {@category Map View} class MinZoomRangeException implements Exception { /// Default constructor for [MinZoomRangeException]. const MinZoomRangeException(); diff --git a/lib/src/google_navigation_flutter_android.dart b/lib/src/google_navigation_flutter_android.dart index 3530809..49c5b88 100644 --- a/lib/src/google_navigation_flutter_android.dart +++ b/lib/src/google_navigation_flutter_android.dart @@ -25,18 +25,35 @@ import 'method_channel/method_channel.dart'; /// Google Maps Navigation Platform Android specific functionalities. /// @nodoc class GoogleMapsNavigationAndroid extends GoogleMapsNavigationPlatform - with - CommonNavigationSessionAPI, - CommonNavigationViewAPI, - CommonImageRegistryAPI { + with CommonNavigationSessionAPI, CommonMapViewAPI, CommonImageRegistryAPI { /// Registers the Android implementation of GoogleMapsNavigationPlatform. static void registerWith() { GoogleMapsNavigationPlatform.instance = GoogleMapsNavigationAndroid(); } @override - Widget buildView( - {required NavigationViewInitializationOptions initializationOptions, + Widget buildMapView( + {required MapViewInitializationOptions initializationOptions, + required MapReadyCallback onMapReady}) { + return _buildView( + mapViewType: MapViewType.map, + initializationOptions: initializationOptions, + onMapReady: onMapReady); + } + + @override + Widget buildNavigationView( + {required MapViewInitializationOptions initializationOptions, + required MapReadyCallback onMapReady}) { + return _buildView( + mapViewType: MapViewType.navigation, + initializationOptions: initializationOptions, + onMapReady: onMapReady); + } + + Widget _buildView( + {required MapViewType mapViewType, + required MapViewInitializationOptions initializationOptions, required MapReadyCallback onMapReady}) { // Initialize method channel for view communication if needed. ensureViewAPISetUp(); @@ -45,8 +62,8 @@ class GoogleMapsNavigationAndroid extends GoogleMapsNavigationPlatform const String viewType = 'google_navigation_flutter'; // Build creation params used to initialize navigation view with initial parameters - final NavigationViewCreationOptionsDto creationParams = - buildNavigationViewCreationOptions(initializationOptions); + final ViewCreationOptionsDto creationParams = + buildNavigationViewCreationOptions(mapViewType, initializationOptions); return PlatformViewLink( viewType: viewType, diff --git a/lib/src/google_navigation_flutter_ios.dart b/lib/src/google_navigation_flutter_ios.dart index e8875c4..8e56513 100644 --- a/lib/src/google_navigation_flutter_ios.dart +++ b/lib/src/google_navigation_flutter_ios.dart @@ -24,18 +24,35 @@ import 'method_channel/method_channel.dart'; /// Google Maps Navigation Platform iOS specific functionalities. /// @nodoc class GoogleMapsNavigationIOS extends GoogleMapsNavigationPlatform - with - CommonNavigationSessionAPI, - CommonNavigationViewAPI, - CommonImageRegistryAPI { + with CommonNavigationSessionAPI, CommonMapViewAPI, CommonImageRegistryAPI { /// Registers the iOS implementation of GoogleMapsNavigationPlatform. static void registerWith() { GoogleMapsNavigationPlatform.instance = GoogleMapsNavigationIOS(); } @override - Widget buildView( - {required NavigationViewInitializationOptions initializationOptions, + Widget buildMapView( + {required MapViewInitializationOptions initializationOptions, + required MapReadyCallback onMapReady}) { + return _buildView( + mapViewType: MapViewType.map, + initializationOptions: initializationOptions, + onMapReady: onMapReady); + } + + @override + Widget buildNavigationView( + {required MapViewInitializationOptions initializationOptions, + required MapReadyCallback onMapReady}) { + return _buildView( + mapViewType: MapViewType.navigation, + initializationOptions: initializationOptions, + onMapReady: onMapReady); + } + + Widget _buildView( + {required MapViewType mapViewType, + required MapViewInitializationOptions initializationOptions, required MapReadyCallback onMapReady}) { // Initialize method channel for view communication if needed. ensureViewAPISetUp(); @@ -44,8 +61,8 @@ class GoogleMapsNavigationIOS extends GoogleMapsNavigationPlatform const String viewType = 'google_navigation_flutter'; // Build creation params used to initialize navigation view with initial parameters - final NavigationViewCreationOptionsDto creationParams = - buildNavigationViewCreationOptions(initializationOptions); + final ViewCreationOptionsDto creationParams = + buildNavigationViewCreationOptions(mapViewType, initializationOptions); return UiKitView( viewType: viewType, diff --git a/lib/src/google_navigation_flutter_platform_interface.dart b/lib/src/google_navigation_flutter_platform_interface.dart index fc909cd..ec7e3da 100644 --- a/lib/src/google_navigation_flutter_platform_interface.dart +++ b/lib/src/google_navigation_flutter_platform_interface.dart @@ -26,12 +26,21 @@ import '../google_navigation_flutter.dart'; /// @nodoc typedef MapReadyCallback = void Function(int viewId); +/// Describes the type of Google map view to construct. +enum MapViewType { + /// Navigation view supports navigation overlay, and current navigation session is displayed on the map. + navigation, + + /// Classic map view, without navigation overlay. + map, +} + /// Google Maps Navigation Platform Interface for iOS and Android implementations. /// @nodoc abstract class GoogleMapsNavigationPlatform extends PlatformInterface with NavigationSessionAPIInterface, - NavigationViewAPIInterface, + MapViewAPIInterface, ImageRegistryAPIInterface { /// Constructs a GoogleMapsNavigationPlatform. GoogleMapsNavigationPlatform() : super(token: _token); @@ -58,6 +67,17 @@ abstract class GoogleMapsNavigationPlatform extends PlatformInterface PlatformInterface.verifyToken(instance, _token); } + /// Builds and returns a classic GoogleMaps map view. + /// + /// This method is responsible for creating a navigation view with the + /// provided [initializationOptions]. + /// + /// The [onMapReady] callback is invoked once the platform view has been created + /// and is ready for interaction. + Widget buildMapView( + {required MapViewInitializationOptions initializationOptions, + required MapReadyCallback onMapReady}); + /// Builds and returns a navigation view. /// /// This method is responsible for creating a navigation view with the @@ -65,8 +85,8 @@ abstract class GoogleMapsNavigationPlatform extends PlatformInterface /// /// The [onMapReady] callback is invoked once the platform view has been created /// and is ready for interaction. - Widget buildView( - {required NavigationViewInitializationOptions initializationOptions, + Widget buildNavigationView( + {required MapViewInitializationOptions initializationOptions, required MapReadyCallback onMapReady}); } @@ -225,7 +245,7 @@ abstract mixin class NavigationSessionAPIInterface { /// API interface for actions of the navigation view. /// @nodoc -abstract mixin class NavigationViewAPIInterface { +abstract mixin class MapViewAPIInterface { /// Awaits the platform view to be ready for communication. Future awaitMapReady({required int viewId}); diff --git a/lib/src/method_channel/common_view_api.dart b/lib/src/method_channel/common_view_api.dart index c4e0ce5..342dc46 100644 --- a/lib/src/method_channel/common_view_api.dart +++ b/lib/src/method_channel/common_view_api.dart @@ -22,9 +22,9 @@ import '../google_navigation_flutter_platform_interface.dart'; import 'method_channel.dart'; /// @nodoc -/// Class that handles navigation view communications. -mixin CommonNavigationViewAPI on NavigationViewAPIInterface { - final NavigationViewApi _viewApi = NavigationViewApi(); +/// Class that handles map view and navigation view communications. +mixin CommonMapViewAPI on MapViewAPIInterface { + final MapViewApi _viewApi = MapViewApi(); bool _viewApiHasBeenSetUp = false; final StreamController<_ViewIdEventWrapper> _viewEventStreamController = StreamController<_ViewIdEventWrapper>.broadcast(); @@ -65,17 +65,22 @@ mixin CommonNavigationViewAPI on NavigationViewAPIInterface { /// called when initializing navigation view. void ensureViewAPISetUp() { if (!_viewApiHasBeenSetUp) { - NavigationViewEventApi.setup( - NavigationViewEventApiImpl( - viewEventStreamController: _viewEventStreamController), + ViewEventApi.setup( + ViewEventApiImpl(viewEventStreamController: _viewEventStreamController), ); _viewApiHasBeenSetUp = true; } } /// Builds creation params used to initialize navigation view with initial parameters. - NavigationViewCreationOptionsDto buildNavigationViewCreationOptions( - NavigationViewInitializationOptions initializationSettings) { + ViewCreationOptionsDto buildNavigationViewCreationOptions( + MapViewType mapViewType, + MapViewInitializationOptions initializationSettings) { + assert( + mapViewType == MapViewType.navigation || + initializationSettings.navigationViewOptions == null, + 'Navigation view options can only be set when using navigation view type'); + /// Map options final MapOptions mapOptions = initializationSettings.mapOptions; final CameraPosition cameraPosition = mapOptions.cameraPosition; @@ -103,12 +108,28 @@ mixin CommonNavigationViewAPI on NavigationViewAPIInterface { zoomControlsEnabled: mapOptions.zoomControlsEnabled, cameraTargetBounds: mapOptions.cameraTargetBounds?.toDto()); - // Navigation options - final NavigationViewOptionsDto navigationOptionsMessage = - initializationSettings.navigationViewOptions.toDto(); + // Initialize navigation view options if given + NavigationViewOptionsDto? navigationOptionsMessage; + final NavigationViewOptions? navigationViewOptions = + initializationSettings.navigationViewOptions; + if (navigationViewOptions != null) { + switch (navigationViewOptions.navigationUIEnabledPreference) { + case NavigationUIEnabledPreference.automatic: + navigationOptionsMessage = NavigationViewOptionsDto( + navigationUIEnabledPreference: + NavigationUIEnabledPreferenceDto.automatic); + case NavigationUIEnabledPreference.disabled: + navigationOptionsMessage = NavigationViewOptionsDto( + navigationUIEnabledPreference: + NavigationUIEnabledPreferenceDto.disabled); + } + } - // Build NavigationViewCreationMessage - return NavigationViewCreationOptionsDto( + // Build ViewCreationMessage + return ViewCreationOptionsDto( + mapViewType: mapViewType == MapViewType.navigation + ? MapViewTypeDto.navigation + : MapViewTypeDto.map, mapOptions: mapOptionsMessage, navigationViewOptions: navigationOptionsMessage); } @@ -978,9 +999,9 @@ mixin CommonNavigationViewAPI on NavigationViewAPIInterface { } /// Implementation for navigation view event API event handling. -class NavigationViewEventApiImpl implements NavigationViewEventApi { +class ViewEventApiImpl implements ViewEventApi { /// Initialize implementation for NavigationViewEventApi. - const NavigationViewEventApiImpl({ + const ViewEventApiImpl({ required StreamController viewEventStreamController, }) : _viewEventStreamController = viewEventStreamController; diff --git a/lib/src/method_channel/messages.g.dart b/lib/src/method_channel/messages.g.dart index 18eb36e..932f8eb 100644 --- a/lib/src/method_channel/messages.g.dart +++ b/lib/src/method_channel/messages.g.dart @@ -40,6 +40,15 @@ List wrapResponse( return [error.code, error.message, error.details]; } +/// Describes the type of map to construct. +enum MapViewTypeDto { + /// Navigation view supports navigation overlay, and current navigation session is displayed on the map. + navigation, + + /// Classic map view, without navigation overlay. + map, +} + /// Determines the initial visibility of the navigation UI on map initialization. enum NavigationUIEnabledPreferenceDto { /// Navigation UI gets enabled if the navigation @@ -547,29 +556,35 @@ class NavigationViewOptionsDto { /// /// This message is used to initialize a new navigation view with a /// specified initial parameters. -class NavigationViewCreationOptionsDto { - NavigationViewCreationOptionsDto({ +class ViewCreationOptionsDto { + ViewCreationOptionsDto({ + required this.mapViewType, required this.mapOptions, - required this.navigationViewOptions, + this.navigationViewOptions, }); + MapViewTypeDto mapViewType; + MapOptionsDto mapOptions; - NavigationViewOptionsDto navigationViewOptions; + NavigationViewOptionsDto? navigationViewOptions; Object encode() { return [ + mapViewType.index, mapOptions.encode(), - navigationViewOptions.encode(), + navigationViewOptions?.encode(), ]; } - static NavigationViewCreationOptionsDto decode(Object result) { + static ViewCreationOptionsDto decode(Object result) { result as List; - return NavigationViewCreationOptionsDto( - mapOptions: MapOptionsDto.decode(result[0]! as List), - navigationViewOptions: - NavigationViewOptionsDto.decode(result[1]! as List), + return ViewCreationOptionsDto( + mapViewType: MapViewTypeDto.values[result[0]! as int], + mapOptions: MapOptionsDto.decode(result[1]! as List), + navigationViewOptions: result[2] != null + ? NavigationViewOptionsDto.decode(result[2]! as List) + : null, ); } } @@ -1909,10 +1924,10 @@ class __NavigationViewCreationApiCodec extends StandardMessageCodec { } else if (value is MapOptionsDto) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is NavigationViewCreationOptionsDto) { + } else if (value is NavigationViewOptionsDto) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is NavigationViewOptionsDto) { + } else if (value is ViewCreationOptionsDto) { buffer.putUint8(133); writeValue(buffer, value.encode()); } else { @@ -1932,9 +1947,9 @@ class __NavigationViewCreationApiCodec extends StandardMessageCodec { case 131: return MapOptionsDto.decode(readValue(buffer)!); case 132: - return NavigationViewCreationOptionsDto.decode(readValue(buffer)!); - case 133: return NavigationViewOptionsDto.decode(readValue(buffer)!); + case 133: + return ViewCreationOptionsDto.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -1955,7 +1970,7 @@ class _NavigationViewCreationApi { static const MessageCodec pigeonChannelCodec = __NavigationViewCreationApiCodec(); - Future _create(NavigationViewCreationOptionsDto msg) async { + Future _create(ViewCreationOptionsDto msg) async { const String __pigeon_channelName = 'dev.flutter.pigeon.google_navigation_flutter._NavigationViewCreationApi._create'; final BasicMessageChannel __pigeon_channel = @@ -1980,8 +1995,8 @@ class _NavigationViewCreationApi { } } -class _NavigationViewApiCodec extends StandardMessageCodec { - const _NavigationViewApiCodec(); +class _MapViewApiCodec extends StandardMessageCodec { + const _MapViewApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { if (value is CameraPositionDto) { @@ -2093,20 +2108,19 @@ class _NavigationViewApiCodec extends StandardMessageCodec { } } -class NavigationViewApi { - /// Constructor for [NavigationViewApi]. The [binaryMessenger] named argument is +class MapViewApi { + /// Constructor for [MapViewApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - NavigationViewApi({BinaryMessenger? binaryMessenger}) + MapViewApi({BinaryMessenger? binaryMessenger}) : __pigeon_binaryMessenger = binaryMessenger; final BinaryMessenger? __pigeon_binaryMessenger; - static const MessageCodec pigeonChannelCodec = - _NavigationViewApiCodec(); + static const MessageCodec pigeonChannelCodec = _MapViewApiCodec(); Future awaitMapReady(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.awaitMapReady'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.awaitMapReady'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2130,7 +2144,7 @@ class NavigationViewApi { Future isMyLocationEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMyLocationEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMyLocationEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2159,7 +2173,7 @@ class NavigationViewApi { Future setMyLocationEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2183,7 +2197,7 @@ class NavigationViewApi { Future getMyLocation(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMyLocation'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMyLocation'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2207,7 +2221,7 @@ class NavigationViewApi { Future getMapType(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMapType'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMapType'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2236,7 +2250,7 @@ class NavigationViewApi { Future setMapType(int viewId, MapTypeDto mapType) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapType'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapType'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2260,7 +2274,7 @@ class NavigationViewApi { Future setMapStyle(int viewId, String styleJson) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapStyle'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapStyle'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2284,7 +2298,7 @@ class NavigationViewApi { Future isNavigationTripProgressBarEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationTripProgressBarEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationTripProgressBarEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2314,7 +2328,7 @@ class NavigationViewApi { Future setNavigationTripProgressBarEnabled( int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationTripProgressBarEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationTripProgressBarEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2338,7 +2352,7 @@ class NavigationViewApi { Future isNavigationHeaderEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationHeaderEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationHeaderEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2367,7 +2381,7 @@ class NavigationViewApi { Future setNavigationHeaderEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationHeaderEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationHeaderEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2391,7 +2405,7 @@ class NavigationViewApi { Future isNavigationFooterEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationFooterEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationFooterEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2420,7 +2434,7 @@ class NavigationViewApi { Future setNavigationFooterEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationFooterEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationFooterEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2444,7 +2458,7 @@ class NavigationViewApi { Future isRecenterButtonEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isRecenterButtonEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isRecenterButtonEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2473,7 +2487,7 @@ class NavigationViewApi { Future setRecenterButtonEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRecenterButtonEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRecenterButtonEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2497,7 +2511,7 @@ class NavigationViewApi { Future isSpeedLimitIconEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isSpeedLimitIconEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isSpeedLimitIconEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2526,7 +2540,7 @@ class NavigationViewApi { Future setSpeedLimitIconEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedLimitIconEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedLimitIconEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2550,7 +2564,7 @@ class NavigationViewApi { Future isSpeedometerEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isSpeedometerEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isSpeedometerEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2579,7 +2593,7 @@ class NavigationViewApi { Future setSpeedometerEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedometerEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedometerEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2603,7 +2617,7 @@ class NavigationViewApi { Future isTrafficIncidentCardsEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTrafficIncidentCardsEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTrafficIncidentCardsEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2632,7 +2646,7 @@ class NavigationViewApi { Future setTrafficIncidentCardsEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficIncidentCardsEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficIncidentCardsEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2656,7 +2670,7 @@ class NavigationViewApi { Future isNavigationUIEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationUIEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationUIEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2685,7 +2699,7 @@ class NavigationViewApi { Future setNavigationUIEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationUIEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationUIEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2709,7 +2723,7 @@ class NavigationViewApi { Future getCameraPosition(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getCameraPosition'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getCameraPosition'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2738,7 +2752,7 @@ class NavigationViewApi { Future getVisibleRegion(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getVisibleRegion'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getVisibleRegion'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2768,7 +2782,7 @@ class NavigationViewApi { Future followMyLocation( int viewId, CameraPerspectiveDto perspective, double? zoomLevel) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.followMyLocation'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.followMyLocation'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2794,7 +2808,7 @@ class NavigationViewApi { Future animateCameraToCameraPosition( int viewId, CameraPositionDto cameraPosition, int? duration) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToCameraPosition'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToCameraPosition'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2824,7 +2838,7 @@ class NavigationViewApi { Future animateCameraToLatLng( int viewId, LatLngDto point, int? duration) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLng'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLng'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2854,7 +2868,7 @@ class NavigationViewApi { Future animateCameraToLatLngBounds( int viewId, LatLngBoundsDto bounds, double padding, int? duration) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngBounds'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngBounds'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2884,7 +2898,7 @@ class NavigationViewApi { Future animateCameraToLatLngZoom( int viewId, LatLngDto point, double zoom, int? duration) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngZoom'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngZoom'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2914,7 +2928,7 @@ class NavigationViewApi { Future animateCameraByScroll( int viewId, double scrollByDx, double scrollByDy, int? duration) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByScroll'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByScroll'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2945,7 +2959,7 @@ class NavigationViewApi { Future animateCameraByZoom(int viewId, double zoomBy, double? focusDx, double? focusDy, int? duration) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByZoom'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByZoom'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -2976,7 +2990,7 @@ class NavigationViewApi { Future animateCameraToZoom( int viewId, double zoom, int? duration) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToZoom'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToZoom'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3006,7 +3020,7 @@ class NavigationViewApi { Future moveCameraToCameraPosition( int viewId, CameraPositionDto cameraPosition) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToCameraPosition'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToCameraPosition'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3030,7 +3044,7 @@ class NavigationViewApi { Future moveCameraToLatLng(int viewId, LatLngDto point) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLng'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLng'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3055,7 +3069,7 @@ class NavigationViewApi { Future moveCameraToLatLngBounds( int viewId, LatLngBoundsDto bounds, double padding) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngBounds'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngBounds'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3080,7 +3094,7 @@ class NavigationViewApi { Future moveCameraToLatLngZoom( int viewId, LatLngDto point, double zoom) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngZoom'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngZoom'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3105,7 +3119,7 @@ class NavigationViewApi { Future moveCameraByScroll( int viewId, double scrollByDx, double scrollByDy) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByScroll'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByScroll'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3130,7 +3144,7 @@ class NavigationViewApi { Future moveCameraByZoom( int viewId, double zoomBy, double? focusDx, double? focusDy) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByZoom'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByZoom'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3154,7 +3168,7 @@ class NavigationViewApi { Future moveCameraToZoom(int viewId, double zoom) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToZoom'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToZoom'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3178,7 +3192,7 @@ class NavigationViewApi { Future showRouteOverview(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.showRouteOverview'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.showRouteOverview'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3202,7 +3216,7 @@ class NavigationViewApi { Future getMinZoomPreference(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMinZoomPreference'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMinZoomPreference'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3231,7 +3245,7 @@ class NavigationViewApi { Future getMaxZoomPreference(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMaxZoomPreference'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMaxZoomPreference'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3260,7 +3274,7 @@ class NavigationViewApi { Future resetMinMaxZoomPreference(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.resetMinMaxZoomPreference'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.resetMinMaxZoomPreference'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3285,7 +3299,7 @@ class NavigationViewApi { Future setMinZoomPreference( int viewId, double minZoomPreference) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMinZoomPreference'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMinZoomPreference'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3310,7 +3324,7 @@ class NavigationViewApi { Future setMaxZoomPreference( int viewId, double maxZoomPreference) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMaxZoomPreference'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMaxZoomPreference'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3334,7 +3348,7 @@ class NavigationViewApi { Future setMyLocationButtonEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationButtonEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationButtonEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3359,7 +3373,7 @@ class NavigationViewApi { Future setConsumeMyLocationButtonClickEventsEnabled( int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setConsumeMyLocationButtonClickEventsEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setConsumeMyLocationButtonClickEventsEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3383,7 +3397,7 @@ class NavigationViewApi { Future setZoomGesturesEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomGesturesEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomGesturesEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3407,7 +3421,7 @@ class NavigationViewApi { Future setZoomControlsEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomControlsEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomControlsEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3431,7 +3445,7 @@ class NavigationViewApi { Future setCompassEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setCompassEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setCompassEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3455,7 +3469,7 @@ class NavigationViewApi { Future setRotateGesturesEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRotateGesturesEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRotateGesturesEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3479,7 +3493,7 @@ class NavigationViewApi { Future setScrollGesturesEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3504,7 +3518,7 @@ class NavigationViewApi { Future setScrollGesturesDuringRotateOrZoomEnabled( int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesDuringRotateOrZoomEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesDuringRotateOrZoomEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3528,7 +3542,7 @@ class NavigationViewApi { Future setTiltGesturesEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTiltGesturesEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTiltGesturesEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3552,7 +3566,7 @@ class NavigationViewApi { Future setMapToolbarEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapToolbarEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapToolbarEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3576,7 +3590,7 @@ class NavigationViewApi { Future setTrafficEnabled(int viewId, bool enabled) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3600,7 +3614,7 @@ class NavigationViewApi { Future isMyLocationButtonEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMyLocationButtonEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMyLocationButtonEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3629,7 +3643,7 @@ class NavigationViewApi { Future isConsumeMyLocationButtonClickEventsEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isConsumeMyLocationButtonClickEventsEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isConsumeMyLocationButtonClickEventsEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3658,7 +3672,7 @@ class NavigationViewApi { Future isZoomGesturesEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isZoomGesturesEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isZoomGesturesEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3687,7 +3701,7 @@ class NavigationViewApi { Future isZoomControlsEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isZoomControlsEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isZoomControlsEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3716,7 +3730,7 @@ class NavigationViewApi { Future isCompassEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isCompassEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isCompassEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3745,7 +3759,7 @@ class NavigationViewApi { Future isRotateGesturesEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isRotateGesturesEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isRotateGesturesEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3774,7 +3788,7 @@ class NavigationViewApi { Future isScrollGesturesEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isScrollGesturesEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isScrollGesturesEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3803,7 +3817,7 @@ class NavigationViewApi { Future isScrollGesturesEnabledDuringRotateOrZoom(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isScrollGesturesEnabledDuringRotateOrZoom'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isScrollGesturesEnabledDuringRotateOrZoom'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3832,7 +3846,7 @@ class NavigationViewApi { Future isTiltGesturesEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTiltGesturesEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTiltGesturesEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3861,7 +3875,7 @@ class NavigationViewApi { Future isMapToolbarEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMapToolbarEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMapToolbarEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3890,7 +3904,7 @@ class NavigationViewApi { Future isTrafficEnabled(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTrafficEnabled'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTrafficEnabled'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3919,7 +3933,7 @@ class NavigationViewApi { Future> getMarkers(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMarkers'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMarkers'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3949,7 +3963,7 @@ class NavigationViewApi { Future> addMarkers( int viewId, List markers) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addMarkers'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addMarkers'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -3979,7 +3993,7 @@ class NavigationViewApi { Future> updateMarkers( int viewId, List markers) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateMarkers'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateMarkers'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4008,7 +4022,7 @@ class NavigationViewApi { Future removeMarkers(int viewId, List markers) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeMarkers'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeMarkers'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4032,7 +4046,7 @@ class NavigationViewApi { Future clearMarkers(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearMarkers'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearMarkers'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4056,7 +4070,7 @@ class NavigationViewApi { Future clear(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clear'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clear'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4080,7 +4094,7 @@ class NavigationViewApi { Future> getPolygons(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getPolygons'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getPolygons'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4110,7 +4124,7 @@ class NavigationViewApi { Future> addPolygons( int viewId, List polygons) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolygons'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolygons'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4140,7 +4154,7 @@ class NavigationViewApi { Future> updatePolygons( int viewId, List polygons) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolygons'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolygons'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4169,7 +4183,7 @@ class NavigationViewApi { Future removePolygons(int viewId, List polygons) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolygons'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolygons'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4193,7 +4207,7 @@ class NavigationViewApi { Future clearPolygons(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearPolygons'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearPolygons'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4217,7 +4231,7 @@ class NavigationViewApi { Future> getPolylines(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getPolylines'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getPolylines'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4247,7 +4261,7 @@ class NavigationViewApi { Future> addPolylines( int viewId, List polylines) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolylines'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolylines'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4277,7 +4291,7 @@ class NavigationViewApi { Future> updatePolylines( int viewId, List polylines) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolylines'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolylines'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4306,7 +4320,7 @@ class NavigationViewApi { Future removePolylines(int viewId, List polylines) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolylines'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolylines'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4330,7 +4344,7 @@ class NavigationViewApi { Future clearPolylines(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearPolylines'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearPolylines'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4354,7 +4368,7 @@ class NavigationViewApi { Future> getCircles(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getCircles'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getCircles'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4384,7 +4398,7 @@ class NavigationViewApi { Future> addCircles( int viewId, List circles) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addCircles'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addCircles'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4414,7 +4428,7 @@ class NavigationViewApi { Future> updateCircles( int viewId, List circles) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateCircles'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateCircles'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4443,7 +4457,7 @@ class NavigationViewApi { Future removeCircles(int viewId, List circles) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeCircles'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeCircles'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4467,7 +4481,7 @@ class NavigationViewApi { Future clearCircles(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearCircles'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearCircles'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4491,7 +4505,7 @@ class NavigationViewApi { Future registerOnCameraChangedListener(int viewId) async { const String __pigeon_channelName = - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.registerOnCameraChangedListener'; + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.registerOnCameraChangedListener'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, @@ -4667,8 +4681,8 @@ class ImageRegistryApi { } } -class _NavigationViewEventApiCodec extends StandardMessageCodec { - const _NavigationViewEventApiCodec(); +class _ViewEventApiCodec extends StandardMessageCodec { + const _ViewEventApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { if (value is CameraPositionDto) { @@ -4695,9 +4709,8 @@ class _NavigationViewEventApiCodec extends StandardMessageCodec { } } -abstract class NavigationViewEventApi { - static const MessageCodec pigeonChannelCodec = - _NavigationViewEventApiCodec(); +abstract class ViewEventApi { + static const MessageCodec pigeonChannelCodec = _ViewEventApiCodec(); void onMapClickEvent(int viewId, LatLngDto latLng); @@ -4725,12 +4738,11 @@ abstract class NavigationViewEventApi { void onCameraChanged( int viewId, CameraEventTypeDto eventType, CameraPositionDto position); - static void setup(NavigationViewEventApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(ViewEventApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMapClickEvent', + 'dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMapClickEvent', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -4738,14 +4750,14 @@ abstract class NavigationViewEventApi { } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMapClickEvent was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMapClickEvent was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMapClickEvent was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMapClickEvent was null, expected non-null int.'); final LatLngDto? arg_latLng = (args[1] as LatLngDto?); assert(arg_latLng != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMapClickEvent was null, expected non-null LatLngDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMapClickEvent was null, expected non-null LatLngDto.'); try { api.onMapClickEvent(arg_viewId!, arg_latLng!); return wrapResponse(empty: true); @@ -4761,7 +4773,7 @@ abstract class NavigationViewEventApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMapLongClickEvent', + 'dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMapLongClickEvent', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -4769,14 +4781,14 @@ abstract class NavigationViewEventApi { } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMapLongClickEvent was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMapLongClickEvent was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMapLongClickEvent was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMapLongClickEvent was null, expected non-null int.'); final LatLngDto? arg_latLng = (args[1] as LatLngDto?); assert(arg_latLng != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMapLongClickEvent was null, expected non-null LatLngDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMapLongClickEvent was null, expected non-null LatLngDto.'); try { api.onMapLongClickEvent(arg_viewId!, arg_latLng!); return wrapResponse(empty: true); @@ -4792,7 +4804,7 @@ abstract class NavigationViewEventApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onRecenterButtonClicked', + 'dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onRecenterButtonClicked', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -4800,11 +4812,11 @@ abstract class NavigationViewEventApi { } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onRecenterButtonClicked was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onRecenterButtonClicked was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onRecenterButtonClicked was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onRecenterButtonClicked was null, expected non-null int.'); try { api.onRecenterButtonClicked(arg_viewId!); return wrapResponse(empty: true); @@ -4820,7 +4832,7 @@ abstract class NavigationViewEventApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerEvent', + 'dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerEvent', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -4828,19 +4840,19 @@ abstract class NavigationViewEventApi { } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerEvent was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerEvent was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerEvent was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerEvent was null, expected non-null int.'); final String? arg_markerId = (args[1] as String?); assert(arg_markerId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerEvent was null, expected non-null String.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerEvent was null, expected non-null String.'); final MarkerEventTypeDto? arg_eventType = args[2] == null ? null : MarkerEventTypeDto.values[args[2]! as int]; assert(arg_eventType != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerEvent was null, expected non-null MarkerEventTypeDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerEvent was null, expected non-null MarkerEventTypeDto.'); try { api.onMarkerEvent(arg_viewId!, arg_markerId!, arg_eventType!); return wrapResponse(empty: true); @@ -4856,7 +4868,7 @@ abstract class NavigationViewEventApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerDragEvent', + 'dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerDragEvent', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -4864,22 +4876,22 @@ abstract class NavigationViewEventApi { } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerDragEvent was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerDragEvent was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerDragEvent was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerDragEvent was null, expected non-null int.'); final String? arg_markerId = (args[1] as String?); assert(arg_markerId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerDragEvent was null, expected non-null String.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerDragEvent was null, expected non-null String.'); final MarkerDragEventTypeDto? arg_eventType = args[2] == null ? null : MarkerDragEventTypeDto.values[args[2]! as int]; assert(arg_eventType != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerDragEvent was null, expected non-null MarkerDragEventTypeDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerDragEvent was null, expected non-null MarkerDragEventTypeDto.'); final LatLngDto? arg_position = (args[3] as LatLngDto?); assert(arg_position != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMarkerDragEvent was null, expected non-null LatLngDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMarkerDragEvent was null, expected non-null LatLngDto.'); try { api.onMarkerDragEvent( arg_viewId!, arg_markerId!, arg_eventType!, arg_position!); @@ -4896,7 +4908,7 @@ abstract class NavigationViewEventApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onPolygonClicked', + 'dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onPolygonClicked', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -4904,14 +4916,14 @@ abstract class NavigationViewEventApi { } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onPolygonClicked was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onPolygonClicked was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onPolygonClicked was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onPolygonClicked was null, expected non-null int.'); final String? arg_polygonId = (args[1] as String?); assert(arg_polygonId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onPolygonClicked was null, expected non-null String.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onPolygonClicked was null, expected non-null String.'); try { api.onPolygonClicked(arg_viewId!, arg_polygonId!); return wrapResponse(empty: true); @@ -4927,7 +4939,7 @@ abstract class NavigationViewEventApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onPolylineClicked', + 'dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onPolylineClicked', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -4935,14 +4947,14 @@ abstract class NavigationViewEventApi { } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onPolylineClicked was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onPolylineClicked was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onPolylineClicked was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onPolylineClicked was null, expected non-null int.'); final String? arg_polylineId = (args[1] as String?); assert(arg_polylineId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onPolylineClicked was null, expected non-null String.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onPolylineClicked was null, expected non-null String.'); try { api.onPolylineClicked(arg_viewId!, arg_polylineId!); return wrapResponse(empty: true); @@ -4958,7 +4970,7 @@ abstract class NavigationViewEventApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCircleClicked', + 'dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCircleClicked', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -4966,14 +4978,14 @@ abstract class NavigationViewEventApi { } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCircleClicked was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCircleClicked was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCircleClicked was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCircleClicked was null, expected non-null int.'); final String? arg_circleId = (args[1] as String?); assert(arg_circleId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCircleClicked was null, expected non-null String.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCircleClicked was null, expected non-null String.'); try { api.onCircleClicked(arg_viewId!, arg_circleId!); return wrapResponse(empty: true); @@ -4989,7 +5001,7 @@ abstract class NavigationViewEventApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onNavigationUIEnabledChanged', + 'dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onNavigationUIEnabledChanged', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -4997,14 +5009,14 @@ abstract class NavigationViewEventApi { } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onNavigationUIEnabledChanged was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onNavigationUIEnabledChanged was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onNavigationUIEnabledChanged was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onNavigationUIEnabledChanged was null, expected non-null int.'); final bool? arg_navigationUIEnabled = (args[1] as bool?); assert(arg_navigationUIEnabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onNavigationUIEnabledChanged was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onNavigationUIEnabledChanged was null, expected non-null bool.'); try { api.onNavigationUIEnabledChanged( arg_viewId!, arg_navigationUIEnabled!); @@ -5021,7 +5033,7 @@ abstract class NavigationViewEventApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMyLocationClicked', + 'dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMyLocationClicked', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -5029,11 +5041,11 @@ abstract class NavigationViewEventApi { } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMyLocationClicked was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMyLocationClicked was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMyLocationClicked was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMyLocationClicked was null, expected non-null int.'); try { api.onMyLocationClicked(arg_viewId!); return wrapResponse(empty: true); @@ -5049,7 +5061,7 @@ abstract class NavigationViewEventApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMyLocationButtonClicked', + 'dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMyLocationButtonClicked', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -5057,11 +5069,11 @@ abstract class NavigationViewEventApi { } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMyLocationButtonClicked was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMyLocationButtonClicked was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onMyLocationButtonClicked was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onMyLocationButtonClicked was null, expected non-null int.'); try { api.onMyLocationButtonClicked(arg_viewId!); return wrapResponse(empty: true); @@ -5077,7 +5089,7 @@ abstract class NavigationViewEventApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCameraChanged', + 'dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCameraChanged', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -5085,20 +5097,20 @@ abstract class NavigationViewEventApi { } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCameraChanged was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCameraChanged was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCameraChanged was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCameraChanged was null, expected non-null int.'); final CameraEventTypeDto? arg_eventType = args[1] == null ? null : CameraEventTypeDto.values[args[1]! as int]; assert(arg_eventType != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCameraChanged was null, expected non-null CameraEventTypeDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCameraChanged was null, expected non-null CameraEventTypeDto.'); final CameraPositionDto? arg_position = (args[2] as CameraPositionDto?); assert(arg_position != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewEventApi.onCameraChanged was null, expected non-null CameraPositionDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.ViewEventApi.onCameraChanged was null, expected non-null CameraPositionDto.'); try { api.onCameraChanged(arg_viewId!, arg_eventType!, arg_position!); return wrapResponse(empty: true); diff --git a/lib/src/types/circles.dart b/lib/src/types/circles.dart index f0720dc..e700a03 100644 --- a/lib/src/types/circles.dart +++ b/lib/src/types/circles.dart @@ -19,6 +19,7 @@ import '../../google_navigation_flutter.dart'; /// Circle that has beed added to map. /// {@category Navigation View} +/// {@category Map View} @immutable class Circle { /// Construct [Circle]. @@ -54,6 +55,7 @@ class Circle { /// Defines CircleOptions for a circle. /// {@category Navigation View} +/// {@category Map View} @immutable class CircleOptions { /// Initialize [CircleOptions] object. @@ -157,6 +159,7 @@ class CircleOptions { /// Event emitted when a circle is clicked. /// {@category Navigation View} +/// {@category Map View} @immutable class CircleClickedEvent { /// Initialize [CircleClickedEvent] object. diff --git a/lib/src/types/lat_lng.dart b/lib/src/types/lat_lng.dart index a7f2837..a6846b5 100644 --- a/lib/src/types/lat_lng.dart +++ b/lib/src/types/lat_lng.dart @@ -17,6 +17,7 @@ import 'package:flutter/foundation.dart'; /// LatLng coordinate object. /// {@category Navigation} /// {@category Navigation View} +/// {@category Map View} @immutable class LatLng { /// Initializes a [LatLng] with the provided latitude and longitude values. diff --git a/lib/src/types/lat_lng_bounds.dart b/lib/src/types/lat_lng_bounds.dart index d4ab837..a8a2089 100644 --- a/lib/src/types/lat_lng_bounds.dart +++ b/lib/src/types/lat_lng_bounds.dart @@ -18,6 +18,7 @@ import '../../google_navigation_flutter.dart'; /// LatLngBounds bounds object. /// {@category Navigation View} +/// {@category Map View} @immutable class LatLngBounds { /// Initialize LatLngBounds with the given southwest and northeast points. diff --git a/lib/src/types/markers.dart b/lib/src/types/markers.dart index 1a04a05..e2eddb4 100644 --- a/lib/src/types/markers.dart +++ b/lib/src/types/markers.dart @@ -18,6 +18,7 @@ import '../../google_navigation_flutter.dart'; /// Marker that has beed added to the map. /// {@category Navigation View} +/// {@category Map View} @immutable class Marker { /// Construct [Marker] @@ -53,6 +54,7 @@ class Marker { /// Defines MarkerOptions for a marker. /// {@category Navigation View} +/// {@category Map View} @immutable class MarkerOptions { /// Initialize MarkerOptions object. @@ -196,6 +198,7 @@ class MarkerOptions { /// Text labels for [Marker] info window. /// {@category Navigation View} +/// {@category Map View} @immutable class InfoWindow { /// Construct [InfoWindow] object. @@ -243,6 +246,7 @@ class InfoWindow { /// Specifies the anchor to be at a particular point in the marker image. /// {@category Navigation View} +/// {@category Map View} @immutable class MarkerAnchor { /// Initialize MarkerAnchor object. @@ -274,6 +278,7 @@ class MarkerAnchor { /// Marker event types /// {@category Navigation View} +/// {@category Map View} enum MarkerEventType { /// The marker has been tapped. clicked, @@ -290,6 +295,7 @@ enum MarkerEventType { /// Marker drag event types /// {@category Navigation View} +/// {@category Map View} enum MarkerDragEventType { /// The marker is being dragged. drag, @@ -303,6 +309,7 @@ enum MarkerDragEventType { /// Marker event sent from platform side. /// {@category Navigation View} +/// {@category Map View} @immutable class MarkerEvent { /// Initialize [MarkerEvent] object. @@ -320,6 +327,7 @@ class MarkerEvent { /// Marker drag event sent from platform side. /// {@category Navigation View} +/// {@category Map View} @immutable class MarkerDragEvent { /// Initialize [MarkerDragEvent] object. diff --git a/lib/src/types/navigation_view_types.dart b/lib/src/types/navigation_view_types.dart index 870b2a8..b424476 100644 --- a/lib/src/types/navigation_view_types.dart +++ b/lib/src/types/navigation_view_types.dart @@ -22,6 +22,7 @@ class NavigationViewRecenterButtonClickedEvent {} /// Map type. /// {@category Navigation View} +/// {@category Map View} enum MapType { /// No type set. none, @@ -41,6 +42,7 @@ enum MapType { /// Represents the camera position in a Google Maps view. /// {@category Navigation View} +/// {@category Map View} class CameraPosition { /// Creates a [CameraPosition] object with map centered /// to the [target] with the given [bearing], [tilt] and [zoom] level. @@ -74,6 +76,7 @@ class CameraPosition { /// Parameter given to parameter given to the [GoogleNavigationViewController.followMyLocation] /// to specify the orientation of the camera. /// {@category Navigation View} +/// {@category Map View} enum CameraPerspective { /// A tilted perspective facing in the same direction as the user. tilted, @@ -87,6 +90,7 @@ enum CameraPerspective { /// Represents the click position in a Google Maps view. /// {@category Navigation View} +/// {@category Map View} class MapClickEvent { /// Creates a [MapClickEvent] object. const MapClickEvent(this.target); @@ -107,6 +111,7 @@ class NavigationUIEnabledChangedEvent { /// Represents the long click position in a Google Maps view. /// {@category Navigation View} +/// {@category Map View} class MapLongClickEvent { /// Creates a [MapLongClickEvent] object. const MapLongClickEvent(this.target); @@ -202,6 +207,7 @@ class RouteSegment { /// Internal camera update type. /// {@category Navigation View} +/// {@category Map View} enum CameraUpdateType { /// Camera update to a camera position. cameraPosition, @@ -228,6 +234,7 @@ enum CameraUpdateType { /// Defines a camera move, supporting absolute moves as well as moves relative /// the current position. /// {@category Navigation View} +/// {@category Map View} class CameraUpdate { CameraUpdate._(this.type); @@ -374,14 +381,17 @@ class CameraUpdate { /// My location clicked event. /// {@category Navigation View} +/// {@category Map View} class MyLocationClickedEvent {} /// My location button clicked event. /// {@category Navigation View} +/// {@category Map View} class MyLocationButtonClickedEvent {} /// Represents the event type for [CameraChangedEvent]. /// {@category Navigation View} +/// {@category Map View} enum CameraEventType { /// Camera move initiated by developer or in response to user action. /// For example: zoom buttons, my location button, or marker clicks. @@ -405,6 +415,7 @@ enum CameraEventType { /// Represents camera changed events in a Google Maps view. /// {@category Navigation View} +/// {@category Map View} class CameraChangedEvent { /// Creates a [CameraChangedEvent] object. const CameraChangedEvent({required this.eventType, required this.position}); diff --git a/lib/src/types/polygons.dart b/lib/src/types/polygons.dart index d997ee7..e11d3a2 100644 --- a/lib/src/types/polygons.dart +++ b/lib/src/types/polygons.dart @@ -20,6 +20,7 @@ import '../../google_navigation_flutter.dart'; /// Polygon that has beed added to map. /// {@category Navigation View} +/// {@category Map View} @immutable class Polygon { /// Construct [Polygon]. @@ -55,6 +56,7 @@ class Polygon { /// Defines PolygonOptions for a polygon. /// {@category Navigation View} +/// {@category Map View} @immutable class PolygonOptions { /// Initialize [PolygonOptions] object. @@ -172,6 +174,7 @@ class PolygonOptions { /// Event emitted when a polygon is clicked. /// {@category Navigation View} +/// {@category Map View} @immutable class PolygonClickedEvent { /// Initialize [PolygonClickedEvent] object. diff --git a/lib/src/types/polylines.dart b/lib/src/types/polylines.dart index 837badf..c1123fe 100644 --- a/lib/src/types/polylines.dart +++ b/lib/src/types/polylines.dart @@ -19,6 +19,7 @@ import '../../google_navigation_flutter.dart'; /// Polyline that has beed added to map. /// {@category Navigation View} +/// {@category Map View} @immutable class Polyline { /// Construct [Polyline]. @@ -54,6 +55,7 @@ class Polyline { /// Defines PolylineOptions for a polyline. /// {@category Navigation View} +/// {@category Map View} @immutable class PolylineOptions { /// Initialize [PolylineOptions] object. @@ -165,6 +167,7 @@ class PolylineOptions { /// Style for stroke of a polyline. /// {@category Navigation View} +/// {@category Map View} class StyleSpanStrokeStyle { /// Initialize with solid color. StyleSpanStrokeStyle.solidColor({ @@ -189,6 +192,7 @@ class StyleSpanStrokeStyle { /// Style and length of a stroke on polyline. /// {@category Navigation View} +/// {@category Map View} class StyleSpan { /// Initialize with length and style. StyleSpan({ @@ -205,6 +209,7 @@ class StyleSpan { /// Joint types for [Polyline] and outline of [Polygon]. /// {@category Navigation View} +/// {@category Map View} enum StrokeJointType { /// Flat bevel on the outside of the joint. bevel, @@ -218,6 +223,7 @@ enum StrokeJointType { /// Event emitted when a polyline is clicked. /// {@category Navigation View} +/// {@category Map View} @immutable class PolylineClickedEvent { /// Initialize [PolylineClickedEvent] object. diff --git a/lib/src/types/stroke_patterns.dart b/lib/src/types/stroke_patterns.dart index 302d510..00d2c96 100644 --- a/lib/src/types/stroke_patterns.dart +++ b/lib/src/types/stroke_patterns.dart @@ -19,6 +19,7 @@ import '../../google_navigation_flutter.dart'; /// Pattern used in the stroke pattern for a [Polyline] or the outline of a [Polygon] or [Circle]. /// {@category Navigation View} +/// {@category Map View} enum PatternType { /// Dash pattern. dash, @@ -32,6 +33,7 @@ enum PatternType { /// Item used in the stroke pattern for a Polyline or the outline of a Polygon or Circle. /// {@category Navigation View} +/// {@category Map View} abstract class PatternItem { /// Initialize [PatternItem] object. const PatternItem(this.type); @@ -42,6 +44,7 @@ abstract class PatternItem { /// Class representing a dash used in the stroke pattern for a [Polyline] or the outline of a [Polygon] or [Circle]. /// {@category Navigation View} +/// {@category Map View} @immutable class DashPattern extends PatternItem { /// Initialize [DashPattern] object. @@ -67,6 +70,7 @@ class DashPattern extends PatternItem { /// Class representing a dot used in the stroke pattern for a [Polyline] or the outline of a [Polygon] or [Circle]. /// {@category Navigation View} +/// {@category Map View} @immutable class DotPattern extends PatternItem { /// Initialize [DotPattern] object. @@ -75,6 +79,7 @@ class DotPattern extends PatternItem { /// Class representing a gap used in the stroke pattern for a [Polyline] or the outline of a [Polygon] or [Circle]. /// {@category Navigation View} +/// {@category Map View} @immutable class GapPattern extends PatternItem { /// Initialize [GapPattern] object. diff --git a/lib/src/types/view_initialization_options.dart b/lib/src/types/view_initialization_options.dart index 7a1228f..21b8c5e 100644 --- a/lib/src/types/view_initialization_options.dart +++ b/lib/src/types/view_initialization_options.dart @@ -36,14 +36,15 @@ import '../../google_navigation_flutter.dart'; /// ); /// ``` /// {@category Navigation View} +/// {@category Map View} @immutable -class NavigationViewInitializationOptions { - /// Creates a new instance of [NavigationViewInitializationOptions] with the given initial +class MapViewInitializationOptions { + /// Creates a new instance of [MapViewInitializationOptions ] with the given initial /// parameters to configure the navigation view. - const NavigationViewInitializationOptions({ + const MapViewInitializationOptions({ required this.layoutDirection, required this.mapOptions, - required this.navigationViewOptions, + this.navigationViewOptions, this.gestureRecognizers = const >{}, }); @@ -51,7 +52,7 @@ class NavigationViewInitializationOptions { final MapOptions mapOptions; /// The initial navigation options for the navigation view. - final NavigationViewOptions navigationViewOptions; + final NavigationViewOptions? navigationViewOptions; /// A direction in which text flows on the widget. final TextDirection layoutDirection; @@ -80,24 +81,25 @@ class NavigationViewInitializationOptions { /// ); /// ``` /// {@category Navigation View} +/// {@category Map View} @immutable class MapOptions { /// Creates a new instance of [MapOptions] with the given initial /// parameters to configure the map view. const MapOptions({ - required this.cameraPosition, - required this.mapType, - required this.compassEnabled, - required this.rotateGesturesEnabled, - required this.scrollGesturesEnabled, - required this.tiltGesturesEnabled, - required this.zoomGesturesEnabled, - required this.scrollGesturesEnabledDuringRotateOrZoom, - required this.mapToolbarEnabled, - required this.minZoomPreference, - required this.maxZoomPreference, - required this.zoomControlsEnabled, - required this.cameraTargetBounds, + this.cameraPosition = const CameraPosition(), + this.mapType = MapType.normal, + this.compassEnabled = true, + this.rotateGesturesEnabled = true, + this.scrollGesturesEnabled = true, + this.tiltGesturesEnabled = true, + this.zoomGesturesEnabled = true, + this.scrollGesturesEnabledDuringRotateOrZoom = true, + this.mapToolbarEnabled = true, + this.minZoomPreference, + this.maxZoomPreference, + this.zoomControlsEnabled = true, + this.cameraTargetBounds, }) : assert( minZoomPreference == null || maxZoomPreference == null || @@ -111,24 +113,53 @@ class MapOptions { final MapType mapType; /// Specifies whether the compass should be enabled. + /// + /// The compass is an icon on the map that indicates the direction of north on the map. + /// If enabled, it is only shown when the camera is tilted or rotated away from + /// its default orientation (tilt of 0 and a bearing of 0). + /// + /// By default, the compass is enabled. final bool compassEnabled; /// Specifies whether rotate gestures should be enabled. + /// + /// If enabled, users can use a two-finger rotate gesture to rotate the camera. + /// If disabled, users cannot rotate the camera via gestures. + /// This setting doesn't restrict the user from tapping the compass icon to reset the camera orientation, + /// nor does it restrict programmatic movements and animation of the camera. + /// + /// By default, the rotation gestures are enabled. final bool rotateGesturesEnabled; /// Specifies whether scroll gestures should be enabled. + /// + /// By default, the scroll gestures are enabled. final bool scrollGesturesEnabled; /// Specifies whether tilt gestures should be enabled. + /// + /// By default, the tilt gestures are enabled. final bool tiltGesturesEnabled; /// Specifies whether zoom gestures should be enabled. + /// + /// By default, the zoom gestures enabled. final bool zoomGesturesEnabled; /// Specifies whether scroll gestures during rotate or zoom should be enabled. + /// + /// If enabled, users can swipe to pan the camera. If disabled, swiping has no effect. + /// This setting doesn't restrict programmatic movement and animation of the camera. + /// + /// By default, the zoom gestures enabled. final bool scrollGesturesEnabledDuringRotateOrZoom; /// Specifies whether the mapToolbar should be enabled. Only applicable on Android. + /// + /// If enabled, and the Map Toolbar can be shown in the current context, + /// users will see a bar with various context-dependent actions. + /// + /// By default, the Map Toolbar is enabled. final bool mapToolbarEnabled; /// Specifies a preferred lower bound for camera zoom. @@ -136,16 +167,21 @@ class MapOptions { /// Null value means unbounded. final double? minZoomPreference; - /// Specifies a preferred upper bound for camera zoom. + /// Specifies a preferred lower bound for camera zoom. /// /// Null value means unbounded. + /// Null by default (not limited). final double? maxZoomPreference; /// Specifies whether the zoom controls should be enabled. Only applicable on Android. + /// + /// By default, the zoom controls are enabled. final bool zoomControlsEnabled; /// Specifies a bounds to constrain the camera target, so that when users scroll and pan the map, /// the camera target does not move outside these bounds. + /// + /// Null by default (unbounded). final LatLngBounds? cameraTargetBounds; } diff --git a/pigeons/messages.dart b/pigeons/messages.dart index 21880b3..6675add 100644 --- a/pigeons/messages.dart +++ b/pigeons/messages.dart @@ -27,6 +27,15 @@ import 'package:pigeon/pigeon.dart'; ), ) +/// Describes the type of map to construct. +enum MapViewTypeDto { + /// Navigation view supports navigation overlay, and current navigation session is displayed on the map. + navigation, + + /// Classic map view, without navigation overlay. + map, +} + /// Object containing map options used to initialize Google Map view. class MapOptionsDto { MapOptionsDto({ @@ -110,13 +119,15 @@ class NavigationViewOptionsDto { /// /// This message is used to initialize a new navigation view with a /// specified initial parameters. -class NavigationViewCreationOptionsDto { - NavigationViewCreationOptionsDto({ +class ViewCreationOptionsDto { + ViewCreationOptionsDto({ + required this.mapViewType, required this.mapOptions, required this.navigationViewOptions, }); + final MapViewTypeDto mapViewType; final MapOptionsDto mapOptions; - final NavigationViewOptionsDto navigationViewOptions; + final NavigationViewOptionsDto? navigationViewOptions; } /// Pigeon only generates messages if the messages are used in API. @@ -126,7 +137,7 @@ class NavigationViewCreationOptionsDto { // ignore: unused_element abstract class _NavigationViewCreationApi { // ignore: unused_element - void _create(NavigationViewCreationOptionsDto msg); + void _create(ViewCreationOptionsDto msg); } enum MapTypeDto { none, normal, satellite, terrain, hybrid } @@ -366,8 +377,8 @@ enum CameraEventTypeDto { onCameraStoppedFollowingLocation } -@HostApi(dartHostTestHandler: 'TestNavigationViewApi') -abstract class NavigationViewApi { +@HostApi(dartHostTestHandler: 'TestMapViewApi') +abstract class MapViewApi { @async void awaitMapReady(int viewId); @@ -498,7 +509,7 @@ abstract class ImageRegistryApi { } @FlutterApi() -abstract class NavigationViewEventApi { +abstract class ViewEventApi { void onMapClickEvent(int viewId, LatLngDto latLng); void onMapLongClickEvent(int viewId, LatLngDto latLng); void onRecenterButtonClicked(int viewId); diff --git a/test/google_navigation_flutter_test.dart b/test/google_navigation_flutter_test.dart index 8468df7..1793b7a 100644 --- a/test/google_navigation_flutter_test.dart +++ b/test/google_navigation_flutter_test.dart @@ -22,17 +22,15 @@ import 'package:mockito/mockito.dart'; import 'google_navigation_flutter_test.mocks.dart'; import 'messages_test.g.dart'; -@GenerateMocks([ - TestNavigationSessionApi, - TestNavigationViewApi, - TestImageRegistryApi -]) +@GenerateMocks( + [TestNavigationSessionApi, TestMapViewApi, TestImageRegistryApi]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); - void onViewCreated(GoogleNavigationViewController controller) {} + void onNavigationViewCreated(GoogleNavigationViewController controller) {} + void onMapViewCreated(GoogleMapViewController controller) {} late MockTestNavigationSessionApi sessionMockApi; - late MockTestNavigationViewApi viewMockApi; + late MockTestMapViewApi viewMockApi; late MockTestImageRegistryApi imageRegistryMockApi; final List platforms = @@ -43,10 +41,10 @@ void main() { setUp(() { sessionMockApi = MockTestNavigationSessionApi(); - viewMockApi = MockTestNavigationViewApi(); + viewMockApi = MockTestMapViewApi(); imageRegistryMockApi = MockTestImageRegistryApi(); TestNavigationSessionApi.setup(sessionMockApi); - TestNavigationViewApi.setup(viewMockApi); + TestMapViewApi.setup(viewMockApi); TestImageRegistryApi.setup(imageRegistryMockApi); }); @@ -61,18 +59,29 @@ void main() { GoogleMapsNavigationPlatform.instance = platform; }); - testWidgets('renders Google Maps Navigation', + testWidgets('renders Google Maps Navigation View', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: GoogleMapsNavigationView( - onViewCreated: onViewCreated, + onViewCreated: onNavigationViewCreated, ), ), ); expect(find.byType(GoogleMapsNavigationView), findsOneWidget); }); + testWidgets('renders Google Maps View', (WidgetTester tester) async { + await tester.pumpWidget( + MaterialApp( + home: GoogleMapsMapView( + onViewCreated: onMapViewCreated, + ), + ), + ); + expect(find.byType(GoogleMapsMapView), findsOneWidget); + }); + group('Navigation view API', () { test('Await map ready api call', () async { // Mock api response diff --git a/test/google_navigation_flutter_test.mocks.dart b/test/google_navigation_flutter_test.mocks.dart index 465aa6f..ad73b60 100644 --- a/test/google_navigation_flutter_test.mocks.dart +++ b/test/google_navigation_flutter_test.mocks.dart @@ -445,12 +445,11 @@ class MockTestNavigationSessionApi extends _i1.Mock ); } -/// A class which mocks [TestNavigationViewApi]. +/// A class which mocks [TestMapViewApi]. /// /// See the documentation for Mockito's code generation for more information. -class MockTestNavigationViewApi extends _i1.Mock - implements _i3.TestNavigationViewApi { - MockTestNavigationViewApi() { +class MockTestMapViewApi extends _i1.Mock implements _i3.TestMapViewApi { + MockTestMapViewApi() { _i1.throwOnMissingStub(this); } diff --git a/test/messages_test.g.dart b/test/messages_test.g.dart index b01ac6d..e753f6c 100644 --- a/test/messages_test.g.dart +++ b/test/messages_test.g.dart @@ -24,8 +24,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:google_navigation_flutter/src/method_channel/messages.g.dart'; -class _TestNavigationViewApiCodec extends StandardMessageCodec { - const _TestNavigationViewApiCodec(); +class _TestMapViewApiCodec extends StandardMessageCodec { + const _TestMapViewApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { if (value is CameraPositionDto) { @@ -137,11 +137,11 @@ class _TestNavigationViewApiCodec extends StandardMessageCodec { } } -abstract class TestNavigationViewApi { +abstract class TestMapViewApi { static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec pigeonChannelCodec = - _TestNavigationViewApiCodec(); + _TestMapViewApiCodec(); Future awaitMapReady(int viewId); @@ -332,12 +332,11 @@ abstract class TestNavigationViewApi { void registerOnCameraChangedListener(int viewId); - static void setup(TestNavigationViewApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestMapViewApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.awaitMapReady', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.awaitMapReady', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -348,11 +347,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.awaitMapReady was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.awaitMapReady was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.awaitMapReady was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.awaitMapReady was null, expected non-null int.'); try { await api.awaitMapReady(arg_viewId!); return wrapResponse(empty: true); @@ -368,7 +367,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMyLocationEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMyLocationEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -379,11 +378,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMyLocationEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMyLocationEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMyLocationEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMyLocationEnabled was null, expected non-null int.'); try { final bool output = api.isMyLocationEnabled(arg_viewId!); return [output]; @@ -399,7 +398,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -410,14 +409,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationEnabled was null, expected non-null bool.'); try { api.setMyLocationEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -433,7 +432,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMyLocation', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMyLocation', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -444,11 +443,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMyLocation was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMyLocation was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMyLocation was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMyLocation was null, expected non-null int.'); try { final LatLngDto? output = api.getMyLocation(arg_viewId!); return [output]; @@ -464,7 +463,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMapType', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMapType', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -475,11 +474,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMapType was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMapType was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMapType was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMapType was null, expected non-null int.'); try { final MapTypeDto output = api.getMapType(arg_viewId!); return [output.index]; @@ -495,7 +494,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapType', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapType', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -506,15 +505,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapType was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapType was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapType was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapType was null, expected non-null int.'); final MapTypeDto? arg_mapType = args[1] == null ? null : MapTypeDto.values[args[1]! as int]; assert(arg_mapType != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapType was null, expected non-null MapTypeDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapType was null, expected non-null MapTypeDto.'); try { api.setMapType(arg_viewId!, arg_mapType!); return wrapResponse(empty: true); @@ -530,7 +529,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapStyle', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapStyle', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -541,14 +540,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapStyle was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapStyle was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapStyle was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapStyle was null, expected non-null int.'); final String? arg_styleJson = (args[1] as String?); assert(arg_styleJson != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapStyle was null, expected non-null String.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapStyle was null, expected non-null String.'); try { api.setMapStyle(arg_viewId!, arg_styleJson!); return wrapResponse(empty: true); @@ -564,7 +563,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationTripProgressBarEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationTripProgressBarEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -575,11 +574,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationTripProgressBarEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationTripProgressBarEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationTripProgressBarEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationTripProgressBarEnabled was null, expected non-null int.'); try { final bool output = api.isNavigationTripProgressBarEnabled(arg_viewId!); @@ -596,7 +595,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationTripProgressBarEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationTripProgressBarEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -607,14 +606,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationTripProgressBarEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationTripProgressBarEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationTripProgressBarEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationTripProgressBarEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationTripProgressBarEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationTripProgressBarEnabled was null, expected non-null bool.'); try { api.setNavigationTripProgressBarEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -630,7 +629,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationHeaderEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationHeaderEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -641,11 +640,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationHeaderEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationHeaderEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationHeaderEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationHeaderEnabled was null, expected non-null int.'); try { final bool output = api.isNavigationHeaderEnabled(arg_viewId!); return [output]; @@ -661,7 +660,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationHeaderEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationHeaderEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -672,14 +671,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationHeaderEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationHeaderEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationHeaderEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationHeaderEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationHeaderEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationHeaderEnabled was null, expected non-null bool.'); try { api.setNavigationHeaderEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -695,7 +694,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationFooterEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationFooterEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -706,11 +705,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationFooterEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationFooterEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationFooterEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationFooterEnabled was null, expected non-null int.'); try { final bool output = api.isNavigationFooterEnabled(arg_viewId!); return [output]; @@ -726,7 +725,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationFooterEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationFooterEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -737,14 +736,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationFooterEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationFooterEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationFooterEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationFooterEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationFooterEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationFooterEnabled was null, expected non-null bool.'); try { api.setNavigationFooterEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -760,7 +759,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isRecenterButtonEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isRecenterButtonEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -771,11 +770,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isRecenterButtonEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isRecenterButtonEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isRecenterButtonEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isRecenterButtonEnabled was null, expected non-null int.'); try { final bool output = api.isRecenterButtonEnabled(arg_viewId!); return [output]; @@ -791,7 +790,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRecenterButtonEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRecenterButtonEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -802,14 +801,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRecenterButtonEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRecenterButtonEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRecenterButtonEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRecenterButtonEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRecenterButtonEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRecenterButtonEnabled was null, expected non-null bool.'); try { api.setRecenterButtonEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -825,7 +824,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isSpeedLimitIconEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isSpeedLimitIconEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -836,11 +835,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isSpeedLimitIconEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isSpeedLimitIconEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isSpeedLimitIconEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isSpeedLimitIconEnabled was null, expected non-null int.'); try { final bool output = api.isSpeedLimitIconEnabled(arg_viewId!); return [output]; @@ -856,7 +855,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedLimitIconEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedLimitIconEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -867,14 +866,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedLimitIconEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedLimitIconEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedLimitIconEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedLimitIconEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedLimitIconEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedLimitIconEnabled was null, expected non-null bool.'); try { api.setSpeedLimitIconEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -890,7 +889,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isSpeedometerEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isSpeedometerEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -901,11 +900,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isSpeedometerEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isSpeedometerEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isSpeedometerEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isSpeedometerEnabled was null, expected non-null int.'); try { final bool output = api.isSpeedometerEnabled(arg_viewId!); return [output]; @@ -921,7 +920,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedometerEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedometerEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -932,14 +931,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedometerEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedometerEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedometerEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedometerEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setSpeedometerEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setSpeedometerEnabled was null, expected non-null bool.'); try { api.setSpeedometerEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -955,7 +954,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTrafficIncidentCardsEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTrafficIncidentCardsEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -966,11 +965,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTrafficIncidentCardsEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTrafficIncidentCardsEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTrafficIncidentCardsEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTrafficIncidentCardsEnabled was null, expected non-null int.'); try { final bool output = api.isTrafficIncidentCardsEnabled(arg_viewId!); return [output]; @@ -986,7 +985,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficIncidentCardsEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficIncidentCardsEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -997,14 +996,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficIncidentCardsEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficIncidentCardsEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficIncidentCardsEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficIncidentCardsEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficIncidentCardsEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficIncidentCardsEnabled was null, expected non-null bool.'); try { api.setTrafficIncidentCardsEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -1020,7 +1019,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationUIEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationUIEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1031,11 +1030,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationUIEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationUIEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isNavigationUIEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isNavigationUIEnabled was null, expected non-null int.'); try { final bool output = api.isNavigationUIEnabled(arg_viewId!); return [output]; @@ -1051,7 +1050,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationUIEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationUIEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1062,14 +1061,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationUIEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationUIEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationUIEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationUIEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setNavigationUIEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setNavigationUIEnabled was null, expected non-null bool.'); try { api.setNavigationUIEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -1085,7 +1084,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getCameraPosition', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getCameraPosition', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1096,11 +1095,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getCameraPosition was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getCameraPosition was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getCameraPosition was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getCameraPosition was null, expected non-null int.'); try { final CameraPositionDto output = api.getCameraPosition(arg_viewId!); return [output]; @@ -1116,7 +1115,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getVisibleRegion', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getVisibleRegion', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1127,11 +1126,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getVisibleRegion was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getVisibleRegion was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getVisibleRegion was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getVisibleRegion was null, expected non-null int.'); try { final LatLngBoundsDto output = api.getVisibleRegion(arg_viewId!); return [output]; @@ -1147,7 +1146,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.followMyLocation', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.followMyLocation', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1158,16 +1157,16 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.followMyLocation was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.followMyLocation was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.followMyLocation was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.followMyLocation was null, expected non-null int.'); final CameraPerspectiveDto? arg_perspective = args[1] == null ? null : CameraPerspectiveDto.values[args[1]! as int]; assert(arg_perspective != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.followMyLocation was null, expected non-null CameraPerspectiveDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.followMyLocation was null, expected non-null CameraPerspectiveDto.'); final double? arg_zoomLevel = (args[2] as double?); try { api.followMyLocation(arg_viewId!, arg_perspective!, arg_zoomLevel); @@ -1184,7 +1183,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToCameraPosition', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToCameraPosition', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1195,15 +1194,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToCameraPosition was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToCameraPosition was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToCameraPosition was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToCameraPosition was null, expected non-null int.'); final CameraPositionDto? arg_cameraPosition = (args[1] as CameraPositionDto?); assert(arg_cameraPosition != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToCameraPosition was null, expected non-null CameraPositionDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToCameraPosition was null, expected non-null CameraPositionDto.'); final int? arg_duration = (args[2] as int?); try { final bool output = await api.animateCameraToCameraPosition( @@ -1221,7 +1220,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLng', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLng', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1232,14 +1231,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLng was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLng was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLng was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLng was null, expected non-null int.'); final LatLngDto? arg_point = (args[1] as LatLngDto?); assert(arg_point != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLng was null, expected non-null LatLngDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLng was null, expected non-null LatLngDto.'); final int? arg_duration = (args[2] as int?); try { final bool output = await api.animateCameraToLatLng( @@ -1257,7 +1256,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngBounds', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngBounds', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1268,17 +1267,17 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngBounds was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngBounds was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngBounds was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngBounds was null, expected non-null int.'); final LatLngBoundsDto? arg_bounds = (args[1] as LatLngBoundsDto?); assert(arg_bounds != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngBounds was null, expected non-null LatLngBoundsDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngBounds was null, expected non-null LatLngBoundsDto.'); final double? arg_padding = (args[2] as double?); assert(arg_padding != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngBounds was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngBounds was null, expected non-null double.'); final int? arg_duration = (args[3] as int?); try { final bool output = await api.animateCameraToLatLngBounds( @@ -1296,7 +1295,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngZoom', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngZoom', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1307,17 +1306,17 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngZoom was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngZoom was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngZoom was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngZoom was null, expected non-null int.'); final LatLngDto? arg_point = (args[1] as LatLngDto?); assert(arg_point != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngZoom was null, expected non-null LatLngDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngZoom was null, expected non-null LatLngDto.'); final double? arg_zoom = (args[2] as double?); assert(arg_zoom != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToLatLngZoom was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToLatLngZoom was null, expected non-null double.'); final int? arg_duration = (args[3] as int?); try { final bool output = await api.animateCameraToLatLngZoom( @@ -1335,7 +1334,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByScroll', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByScroll', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1346,17 +1345,17 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByScroll was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByScroll was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByScroll was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByScroll was null, expected non-null int.'); final double? arg_scrollByDx = (args[1] as double?); assert(arg_scrollByDx != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByScroll was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByScroll was null, expected non-null double.'); final double? arg_scrollByDy = (args[2] as double?); assert(arg_scrollByDy != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByScroll was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByScroll was null, expected non-null double.'); final int? arg_duration = (args[3] as int?); try { final bool output = await api.animateCameraByScroll( @@ -1374,7 +1373,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByZoom', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByZoom', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1385,14 +1384,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByZoom was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByZoom was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByZoom was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByZoom was null, expected non-null int.'); final double? arg_zoomBy = (args[1] as double?); assert(arg_zoomBy != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraByZoom was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraByZoom was null, expected non-null double.'); final double? arg_focusDx = (args[2] as double?); final double? arg_focusDy = (args[3] as double?); final int? arg_duration = (args[4] as int?); @@ -1412,7 +1411,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToZoom', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToZoom', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1423,14 +1422,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToZoom was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToZoom was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToZoom was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToZoom was null, expected non-null int.'); final double? arg_zoom = (args[1] as double?); assert(arg_zoom != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.animateCameraToZoom was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.animateCameraToZoom was null, expected non-null double.'); final int? arg_duration = (args[2] as int?); try { final bool output = await api.animateCameraToZoom( @@ -1448,7 +1447,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToCameraPosition', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToCameraPosition', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1459,15 +1458,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToCameraPosition was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToCameraPosition was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToCameraPosition was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToCameraPosition was null, expected non-null int.'); final CameraPositionDto? arg_cameraPosition = (args[1] as CameraPositionDto?); assert(arg_cameraPosition != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToCameraPosition was null, expected non-null CameraPositionDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToCameraPosition was null, expected non-null CameraPositionDto.'); try { api.moveCameraToCameraPosition(arg_viewId!, arg_cameraPosition!); return wrapResponse(empty: true); @@ -1483,7 +1482,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLng', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLng', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1494,14 +1493,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLng was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLng was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLng was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLng was null, expected non-null int.'); final LatLngDto? arg_point = (args[1] as LatLngDto?); assert(arg_point != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLng was null, expected non-null LatLngDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLng was null, expected non-null LatLngDto.'); try { api.moveCameraToLatLng(arg_viewId!, arg_point!); return wrapResponse(empty: true); @@ -1517,7 +1516,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngBounds', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngBounds', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1528,17 +1527,17 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngBounds was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngBounds was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngBounds was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngBounds was null, expected non-null int.'); final LatLngBoundsDto? arg_bounds = (args[1] as LatLngBoundsDto?); assert(arg_bounds != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngBounds was null, expected non-null LatLngBoundsDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngBounds was null, expected non-null LatLngBoundsDto.'); final double? arg_padding = (args[2] as double?); assert(arg_padding != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngBounds was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngBounds was null, expected non-null double.'); try { api.moveCameraToLatLngBounds( arg_viewId!, arg_bounds!, arg_padding!); @@ -1555,7 +1554,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngZoom', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngZoom', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1566,17 +1565,17 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngZoom was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngZoom was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngZoom was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngZoom was null, expected non-null int.'); final LatLngDto? arg_point = (args[1] as LatLngDto?); assert(arg_point != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngZoom was null, expected non-null LatLngDto.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngZoom was null, expected non-null LatLngDto.'); final double? arg_zoom = (args[2] as double?); assert(arg_zoom != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToLatLngZoom was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToLatLngZoom was null, expected non-null double.'); try { api.moveCameraToLatLngZoom(arg_viewId!, arg_point!, arg_zoom!); return wrapResponse(empty: true); @@ -1592,7 +1591,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByScroll', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByScroll', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1603,17 +1602,17 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByScroll was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByScroll was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByScroll was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByScroll was null, expected non-null int.'); final double? arg_scrollByDx = (args[1] as double?); assert(arg_scrollByDx != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByScroll was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByScroll was null, expected non-null double.'); final double? arg_scrollByDy = (args[2] as double?); assert(arg_scrollByDy != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByScroll was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByScroll was null, expected non-null double.'); try { api.moveCameraByScroll( arg_viewId!, arg_scrollByDx!, arg_scrollByDy!); @@ -1630,7 +1629,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByZoom', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByZoom', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1641,14 +1640,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByZoom was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByZoom was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByZoom was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByZoom was null, expected non-null int.'); final double? arg_zoomBy = (args[1] as double?); assert(arg_zoomBy != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraByZoom was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraByZoom was null, expected non-null double.'); final double? arg_focusDx = (args[2] as double?); final double? arg_focusDy = (args[3] as double?); try { @@ -1667,7 +1666,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToZoom', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToZoom', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1678,14 +1677,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToZoom was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToZoom was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToZoom was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToZoom was null, expected non-null int.'); final double? arg_zoom = (args[1] as double?); assert(arg_zoom != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.moveCameraToZoom was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.moveCameraToZoom was null, expected non-null double.'); try { api.moveCameraToZoom(arg_viewId!, arg_zoom!); return wrapResponse(empty: true); @@ -1701,7 +1700,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.showRouteOverview', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.showRouteOverview', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1712,11 +1711,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.showRouteOverview was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.showRouteOverview was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.showRouteOverview was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.showRouteOverview was null, expected non-null int.'); try { api.showRouteOverview(arg_viewId!); return wrapResponse(empty: true); @@ -1732,7 +1731,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMinZoomPreference', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMinZoomPreference', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1743,11 +1742,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMinZoomPreference was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMinZoomPreference was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMinZoomPreference was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMinZoomPreference was null, expected non-null int.'); try { final double output = api.getMinZoomPreference(arg_viewId!); return [output]; @@ -1763,7 +1762,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMaxZoomPreference', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMaxZoomPreference', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1774,11 +1773,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMaxZoomPreference was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMaxZoomPreference was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMaxZoomPreference was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMaxZoomPreference was null, expected non-null int.'); try { final double output = api.getMaxZoomPreference(arg_viewId!); return [output]; @@ -1794,7 +1793,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.resetMinMaxZoomPreference', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.resetMinMaxZoomPreference', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1805,11 +1804,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.resetMinMaxZoomPreference was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.resetMinMaxZoomPreference was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.resetMinMaxZoomPreference was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.resetMinMaxZoomPreference was null, expected non-null int.'); try { api.resetMinMaxZoomPreference(arg_viewId!); return wrapResponse(empty: true); @@ -1825,7 +1824,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMinZoomPreference', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMinZoomPreference', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1836,14 +1835,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMinZoomPreference was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMinZoomPreference was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMinZoomPreference was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMinZoomPreference was null, expected non-null int.'); final double? arg_minZoomPreference = (args[1] as double?); assert(arg_minZoomPreference != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMinZoomPreference was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMinZoomPreference was null, expected non-null double.'); try { api.setMinZoomPreference(arg_viewId!, arg_minZoomPreference!); return wrapResponse(empty: true); @@ -1859,7 +1858,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMaxZoomPreference', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMaxZoomPreference', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1870,14 +1869,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMaxZoomPreference was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMaxZoomPreference was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMaxZoomPreference was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMaxZoomPreference was null, expected non-null int.'); final double? arg_maxZoomPreference = (args[1] as double?); assert(arg_maxZoomPreference != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMaxZoomPreference was null, expected non-null double.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMaxZoomPreference was null, expected non-null double.'); try { api.setMaxZoomPreference(arg_viewId!, arg_maxZoomPreference!); return wrapResponse(empty: true); @@ -1893,7 +1892,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationButtonEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationButtonEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1904,14 +1903,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationButtonEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationButtonEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationButtonEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationButtonEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMyLocationButtonEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMyLocationButtonEnabled was null, expected non-null bool.'); try { api.setMyLocationButtonEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -1927,7 +1926,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setConsumeMyLocationButtonClickEventsEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setConsumeMyLocationButtonClickEventsEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1938,14 +1937,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setConsumeMyLocationButtonClickEventsEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setConsumeMyLocationButtonClickEventsEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setConsumeMyLocationButtonClickEventsEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setConsumeMyLocationButtonClickEventsEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setConsumeMyLocationButtonClickEventsEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setConsumeMyLocationButtonClickEventsEnabled was null, expected non-null bool.'); try { api.setConsumeMyLocationButtonClickEventsEnabled( arg_viewId!, arg_enabled!); @@ -1962,7 +1961,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomGesturesEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomGesturesEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1973,14 +1972,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomGesturesEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomGesturesEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomGesturesEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomGesturesEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomGesturesEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomGesturesEnabled was null, expected non-null bool.'); try { api.setZoomGesturesEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -1996,7 +1995,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomControlsEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomControlsEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2007,14 +2006,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomControlsEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomControlsEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomControlsEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomControlsEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setZoomControlsEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setZoomControlsEnabled was null, expected non-null bool.'); try { api.setZoomControlsEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -2030,7 +2029,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setCompassEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setCompassEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2041,14 +2040,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setCompassEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setCompassEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setCompassEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setCompassEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setCompassEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setCompassEnabled was null, expected non-null bool.'); try { api.setCompassEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -2064,7 +2063,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRotateGesturesEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRotateGesturesEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2075,14 +2074,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRotateGesturesEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRotateGesturesEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRotateGesturesEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRotateGesturesEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setRotateGesturesEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setRotateGesturesEnabled was null, expected non-null bool.'); try { api.setRotateGesturesEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -2098,7 +2097,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2109,14 +2108,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesEnabled was null, expected non-null bool.'); try { api.setScrollGesturesEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -2132,7 +2131,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesDuringRotateOrZoomEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesDuringRotateOrZoomEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2143,14 +2142,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesDuringRotateOrZoomEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesDuringRotateOrZoomEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesDuringRotateOrZoomEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesDuringRotateOrZoomEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setScrollGesturesDuringRotateOrZoomEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setScrollGesturesDuringRotateOrZoomEnabled was null, expected non-null bool.'); try { api.setScrollGesturesDuringRotateOrZoomEnabled( arg_viewId!, arg_enabled!); @@ -2167,7 +2166,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTiltGesturesEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTiltGesturesEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2178,14 +2177,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTiltGesturesEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTiltGesturesEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTiltGesturesEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTiltGesturesEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTiltGesturesEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTiltGesturesEnabled was null, expected non-null bool.'); try { api.setTiltGesturesEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -2201,7 +2200,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapToolbarEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapToolbarEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2212,14 +2211,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapToolbarEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapToolbarEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapToolbarEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapToolbarEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setMapToolbarEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setMapToolbarEnabled was null, expected non-null bool.'); try { api.setMapToolbarEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -2235,7 +2234,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2246,14 +2245,14 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficEnabled was null, expected non-null int.'); final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.setTrafficEnabled was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.setTrafficEnabled was null, expected non-null bool.'); try { api.setTrafficEnabled(arg_viewId!, arg_enabled!); return wrapResponse(empty: true); @@ -2269,7 +2268,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMyLocationButtonEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMyLocationButtonEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2280,11 +2279,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMyLocationButtonEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMyLocationButtonEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMyLocationButtonEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMyLocationButtonEnabled was null, expected non-null int.'); try { final bool output = api.isMyLocationButtonEnabled(arg_viewId!); return [output]; @@ -2300,7 +2299,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isConsumeMyLocationButtonClickEventsEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isConsumeMyLocationButtonClickEventsEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2311,11 +2310,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isConsumeMyLocationButtonClickEventsEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isConsumeMyLocationButtonClickEventsEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isConsumeMyLocationButtonClickEventsEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isConsumeMyLocationButtonClickEventsEnabled was null, expected non-null int.'); try { final bool output = api.isConsumeMyLocationButtonClickEventsEnabled(arg_viewId!); @@ -2332,7 +2331,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isZoomGesturesEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isZoomGesturesEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2343,11 +2342,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isZoomGesturesEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isZoomGesturesEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isZoomGesturesEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isZoomGesturesEnabled was null, expected non-null int.'); try { final bool output = api.isZoomGesturesEnabled(arg_viewId!); return [output]; @@ -2363,7 +2362,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isZoomControlsEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isZoomControlsEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2374,11 +2373,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isZoomControlsEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isZoomControlsEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isZoomControlsEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isZoomControlsEnabled was null, expected non-null int.'); try { final bool output = api.isZoomControlsEnabled(arg_viewId!); return [output]; @@ -2394,7 +2393,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isCompassEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isCompassEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2405,11 +2404,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isCompassEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isCompassEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isCompassEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isCompassEnabled was null, expected non-null int.'); try { final bool output = api.isCompassEnabled(arg_viewId!); return [output]; @@ -2425,7 +2424,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isRotateGesturesEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isRotateGesturesEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2436,11 +2435,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isRotateGesturesEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isRotateGesturesEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isRotateGesturesEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isRotateGesturesEnabled was null, expected non-null int.'); try { final bool output = api.isRotateGesturesEnabled(arg_viewId!); return [output]; @@ -2456,7 +2455,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isScrollGesturesEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isScrollGesturesEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2467,11 +2466,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isScrollGesturesEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isScrollGesturesEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isScrollGesturesEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isScrollGesturesEnabled was null, expected non-null int.'); try { final bool output = api.isScrollGesturesEnabled(arg_viewId!); return [output]; @@ -2487,7 +2486,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isScrollGesturesEnabledDuringRotateOrZoom', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isScrollGesturesEnabledDuringRotateOrZoom', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2498,11 +2497,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isScrollGesturesEnabledDuringRotateOrZoom was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isScrollGesturesEnabledDuringRotateOrZoom was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isScrollGesturesEnabledDuringRotateOrZoom was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isScrollGesturesEnabledDuringRotateOrZoom was null, expected non-null int.'); try { final bool output = api.isScrollGesturesEnabledDuringRotateOrZoom(arg_viewId!); @@ -2519,7 +2518,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTiltGesturesEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTiltGesturesEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2530,11 +2529,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTiltGesturesEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTiltGesturesEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTiltGesturesEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTiltGesturesEnabled was null, expected non-null int.'); try { final bool output = api.isTiltGesturesEnabled(arg_viewId!); return [output]; @@ -2550,7 +2549,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMapToolbarEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMapToolbarEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2561,11 +2560,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMapToolbarEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMapToolbarEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isMapToolbarEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isMapToolbarEnabled was null, expected non-null int.'); try { final bool output = api.isMapToolbarEnabled(arg_viewId!); return [output]; @@ -2581,7 +2580,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTrafficEnabled', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTrafficEnabled', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2592,11 +2591,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTrafficEnabled was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTrafficEnabled was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.isTrafficEnabled was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.isTrafficEnabled was null, expected non-null int.'); try { final bool output = api.isTrafficEnabled(arg_viewId!); return [output]; @@ -2612,7 +2611,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMarkers', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMarkers', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2623,11 +2622,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMarkers was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMarkers was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getMarkers was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getMarkers was null, expected non-null int.'); try { final List output = api.getMarkers(arg_viewId!); return [output]; @@ -2643,7 +2642,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addMarkers', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addMarkers', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2654,15 +2653,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addMarkers was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addMarkers was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addMarkers was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addMarkers was null, expected non-null int.'); final List? arg_markers = (args[1] as List?)?.cast(); assert(arg_markers != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addMarkers was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addMarkers was null, expected non-null List.'); try { final List output = api.addMarkers(arg_viewId!, arg_markers!); @@ -2679,7 +2678,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateMarkers', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateMarkers', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2690,15 +2689,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateMarkers was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateMarkers was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateMarkers was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateMarkers was null, expected non-null int.'); final List? arg_markers = (args[1] as List?)?.cast(); assert(arg_markers != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateMarkers was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateMarkers was null, expected non-null List.'); try { final List output = api.updateMarkers(arg_viewId!, arg_markers!); @@ -2715,7 +2714,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeMarkers', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeMarkers', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2726,15 +2725,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeMarkers was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeMarkers was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeMarkers was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeMarkers was null, expected non-null int.'); final List? arg_markers = (args[1] as List?)?.cast(); assert(arg_markers != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeMarkers was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeMarkers was null, expected non-null List.'); try { api.removeMarkers(arg_viewId!, arg_markers!); return wrapResponse(empty: true); @@ -2750,7 +2749,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearMarkers', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearMarkers', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2761,11 +2760,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearMarkers was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearMarkers was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearMarkers was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearMarkers was null, expected non-null int.'); try { api.clearMarkers(arg_viewId!); return wrapResponse(empty: true); @@ -2779,11 +2778,11 @@ abstract class TestNavigationViewApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clear', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clear', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); if (api == null) { _testBinaryMessengerBinding!.defaultBinaryMessenger .setMockDecodedMessageHandler(__pigeon_channel, null); @@ -2792,11 +2791,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clear was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clear was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clear was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clear was null, expected non-null int.'); try { api.clear(arg_viewId!); return wrapResponse(empty: true); @@ -2812,7 +2811,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getPolygons', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getPolygons', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2823,11 +2822,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getPolygons was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getPolygons was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getPolygons was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getPolygons was null, expected non-null int.'); try { final List output = api.getPolygons(arg_viewId!); return [output]; @@ -2843,7 +2842,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolygons', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolygons', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2854,15 +2853,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolygons was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolygons was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolygons was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolygons was null, expected non-null int.'); final List? arg_polygons = (args[1] as List?)?.cast(); assert(arg_polygons != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolygons was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolygons was null, expected non-null List.'); try { final List output = api.addPolygons(arg_viewId!, arg_polygons!); @@ -2879,7 +2878,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolygons', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolygons', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2890,15 +2889,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolygons was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolygons was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolygons was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolygons was null, expected non-null int.'); final List? arg_polygons = (args[1] as List?)?.cast(); assert(arg_polygons != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolygons was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolygons was null, expected non-null List.'); try { final List output = api.updatePolygons(arg_viewId!, arg_polygons!); @@ -2915,7 +2914,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolygons', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolygons', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2926,15 +2925,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolygons was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolygons was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolygons was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolygons was null, expected non-null int.'); final List? arg_polygons = (args[1] as List?)?.cast(); assert(arg_polygons != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolygons was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolygons was null, expected non-null List.'); try { api.removePolygons(arg_viewId!, arg_polygons!); return wrapResponse(empty: true); @@ -2950,7 +2949,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearPolygons', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearPolygons', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2961,11 +2960,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearPolygons was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearPolygons was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearPolygons was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearPolygons was null, expected non-null int.'); try { api.clearPolygons(arg_viewId!); return wrapResponse(empty: true); @@ -2981,7 +2980,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getPolylines', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getPolylines', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -2992,11 +2991,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getPolylines was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getPolylines was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getPolylines was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getPolylines was null, expected non-null int.'); try { final List output = api.getPolylines(arg_viewId!); return [output]; @@ -3012,7 +3011,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolylines', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolylines', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -3023,15 +3022,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolylines was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolylines was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolylines was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolylines was null, expected non-null int.'); final List? arg_polylines = (args[1] as List?)?.cast(); assert(arg_polylines != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addPolylines was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addPolylines was null, expected non-null List.'); try { final List output = api.addPolylines(arg_viewId!, arg_polylines!); @@ -3048,7 +3047,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolylines', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolylines', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -3059,15 +3058,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolylines was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolylines was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolylines was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolylines was null, expected non-null int.'); final List? arg_polylines = (args[1] as List?)?.cast(); assert(arg_polylines != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updatePolylines was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updatePolylines was null, expected non-null List.'); try { final List output = api.updatePolylines(arg_viewId!, arg_polylines!); @@ -3084,7 +3083,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolylines', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolylines', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -3095,15 +3094,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolylines was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolylines was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolylines was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolylines was null, expected non-null int.'); final List? arg_polylines = (args[1] as List?)?.cast(); assert(arg_polylines != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removePolylines was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removePolylines was null, expected non-null List.'); try { api.removePolylines(arg_viewId!, arg_polylines!); return wrapResponse(empty: true); @@ -3119,7 +3118,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearPolylines', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearPolylines', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -3130,11 +3129,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearPolylines was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearPolylines was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearPolylines was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearPolylines was null, expected non-null int.'); try { api.clearPolylines(arg_viewId!); return wrapResponse(empty: true); @@ -3150,7 +3149,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getCircles', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getCircles', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -3161,11 +3160,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getCircles was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getCircles was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.getCircles was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.getCircles was null, expected non-null int.'); try { final List output = api.getCircles(arg_viewId!); return [output]; @@ -3181,7 +3180,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addCircles', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addCircles', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -3192,15 +3191,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addCircles was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addCircles was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addCircles was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addCircles was null, expected non-null int.'); final List? arg_circles = (args[1] as List?)?.cast(); assert(arg_circles != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.addCircles was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.addCircles was null, expected non-null List.'); try { final List output = api.addCircles(arg_viewId!, arg_circles!); @@ -3217,7 +3216,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateCircles', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateCircles', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -3228,15 +3227,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateCircles was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateCircles was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateCircles was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateCircles was null, expected non-null int.'); final List? arg_circles = (args[1] as List?)?.cast(); assert(arg_circles != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.updateCircles was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.updateCircles was null, expected non-null List.'); try { final List output = api.updateCircles(arg_viewId!, arg_circles!); @@ -3253,7 +3252,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeCircles', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeCircles', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -3264,15 +3263,15 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeCircles was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeCircles was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeCircles was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeCircles was null, expected non-null int.'); final List? arg_circles = (args[1] as List?)?.cast(); assert(arg_circles != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.removeCircles was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.removeCircles was null, expected non-null List.'); try { api.removeCircles(arg_viewId!, arg_circles!); return wrapResponse(empty: true); @@ -3288,7 +3287,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearCircles', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearCircles', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -3299,11 +3298,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearCircles was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearCircles was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.clearCircles was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.clearCircles was null, expected non-null int.'); try { api.clearCircles(arg_viewId!); return wrapResponse(empty: true); @@ -3319,7 +3318,7 @@ abstract class TestNavigationViewApi { { final BasicMessageChannel __pigeon_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.registerOnCameraChangedListener', + 'dev.flutter.pigeon.google_navigation_flutter.MapViewApi.registerOnCameraChangedListener', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -3330,11 +3329,11 @@ abstract class TestNavigationViewApi { .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.registerOnCameraChangedListener was null.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.registerOnCameraChangedListener was null.'); final List args = (message as List?)!; final int? arg_viewId = (args[0] as int?); assert(arg_viewId != null, - 'Argument for dev.flutter.pigeon.google_navigation_flutter.NavigationViewApi.registerOnCameraChangedListener was null, expected non-null int.'); + 'Argument for dev.flutter.pigeon.google_navigation_flutter.MapViewApi.registerOnCameraChangedListener was null, expected non-null int.'); try { api.registerOnCameraChangedListener(arg_viewId!); return wrapResponse(empty: true);