From 6e3a9b39b23680086d1870a92e9ccdfd444bc851 Mon Sep 17 00:00:00 2001 From: Seungsoo Lee Date: Sun, 18 Oct 2026 04:21:57 +0900 Subject: [PATCH 1/9] [google_maps_flutter] Support map UI control options Implement mapTypeControlEnabled, fullscreenControlEnabled and streetViewControlEnabled (google_maps_flutter_platform_interface 2.16.0, https://github.com/flutter/packages/pull/12191) and webCameraControlEnabled and webCameraControlPosition (platform interface 2.14.0), following google_maps_flutter_web 0.6.3. Previously the three controls were always off and the camera control options were ignored. updateMapConfiguration is overridden because the default implementation serializes the configuration without these options, so changes after the map was created were dropped. --- packages/google_maps_flutter/CHANGELOG.md | 4 +++ packages/google_maps_flutter/README.md | 2 +- .../google_maps_flutter/lib/src/convert.dart | 31 ++++++++++++++++--- .../lib/src/google_maps_flutter_tizen.dart | 6 ++++ packages/google_maps_flutter/pubspec.yaml | 2 +- 5 files changed, 39 insertions(+), 6 deletions(-) diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md index 1bd301926..c932d838d 100644 --- a/packages/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.0 + +* Add support for `mapTypeControlEnabled`, `fullscreenControlEnabled`, `streetViewControlEnabled`, `webCameraControlEnabled`, and `webCameraControlPosition`. + ## 0.3.0 * Update `webview_flutter_lwe` to ^0.6.0. diff --git a/packages/google_maps_flutter/README.md b/packages/google_maps_flutter/README.md index bc360b151..3b9f9c238 100644 --- a/packages/google_maps_flutter/README.md +++ b/packages/google_maps_flutter/README.md @@ -21,7 +21,7 @@ This package is not an _endorsed_ implementation of `google_maps_flutter`. There ```yaml dependencies: google_maps_flutter: ^2.18.0 - google_maps_flutter_tizen: ^0.3.0 + google_maps_flutter_tizen: ^0.4.0 ``` For detailed usage, see https://pub.dev/packages/google_maps_flutter#sample-usage. diff --git a/packages/google_maps_flutter/lib/src/convert.dart b/packages/google_maps_flutter/lib/src/convert.dart index a90cc004a..3faa20160 100644 --- a/packages/google_maps_flutter/lib/src/convert.dart +++ b/packages/google_maps_flutter/lib/src/convert.dart @@ -19,7 +19,8 @@ Map _mapTypeToMapTypeId = { // Builds the raw map options map from a [MapConfiguration]. // // This mirrors the platform interface's `jsonForMapConfiguration` helper -// (which is not exported), plus [MapConfiguration.colorScheme]. +// (which is not exported), plus [MapConfiguration.colorScheme] and the web +// control options. // // Intentionally omitted: // * `cloudMapId` — deprecated alias for `mapId`, which is already serialized. @@ -53,6 +54,15 @@ Map _mapOptionsFromConfiguration(MapConfiguration config) { if (config.mapId != null) 'mapId': config.mapId, if (config.style != null) 'style': config.style, if (config.colorScheme != null) 'colorScheme': config.colorScheme!.index, + if (config.webCameraControlEnabled != null) + 'webCameraControlEnabled': config.webCameraControlEnabled, + if (config.webCameraControlPosition != null) + 'webCameraControlPosition': config.webCameraControlPosition!.name, + if (config.mapTypeControlEnabled != null) 'mapTypeControlEnabled': config.mapTypeControlEnabled, + if (config.fullscreenControlEnabled != null) + 'fullscreenControlEnabled': config.fullscreenControlEnabled, + if (config.streetViewControlEnabled != null) + 'streetViewControlEnabled': config.streetViewControlEnabled, }; } @@ -89,9 +99,11 @@ String? _getCameraBounds(dynamic option) { // web buildingsEnabled seems to not have an equivalent in web padding seems to // behave differently in web than mobile. You can't move UI elements in web. String _rawOptionsToString(Map rawOptions) { - // These don't have any rawOptions entry, but they seem to be off in the - // native maps. - var options = 'mapTypeControl: false, fullscreenControl: false, streetViewControl: false'; + // These are off by default in the native maps. + var options = + 'mapTypeControl: ${rawOptions['mapTypeControlEnabled'] ?? false}' + ', fullscreenControl: ${rawOptions['fullscreenControlEnabled'] ?? false}' + ', streetViewControl: ${rawOptions['streetViewControlEnabled'] ?? false}'; if (_mapTypeToMapTypeId.containsKey(rawOptions['mapType'])) { options += ", mapTypeId: '${_mapTypeToMapTypeId[rawOptions['mapType']]}'"; @@ -115,6 +127,17 @@ String _rawOptionsToString(Map rawOptions) { options += ', zoomControl: ${rawOptions['zoomControlsEnabled']}'; } + if (rawOptions['webCameraControlEnabled'] != null) { + options += ', cameraControl: ${rawOptions['webCameraControlEnabled']}'; + } + + if (rawOptions['webCameraControlPosition'] != null) { + final String position = (rawOptions['webCameraControlPosition'] as String) + .replaceAllMapped(RegExp('[A-Z]'), (Match m) => '_${m[0]}') + .toUpperCase(); + options += ', cameraControlOptions: { position: google.maps.ControlPosition.$position }'; + } + if (rawOptions['style'] != null && (rawOptions['style'] as String).isNotEmpty) { options += ', styles: ${rawOptions['style']}'; } else { diff --git a/packages/google_maps_flutter/lib/src/google_maps_flutter_tizen.dart b/packages/google_maps_flutter/lib/src/google_maps_flutter_tizen.dart index 7b439cf8f..ad9e7aa83 100644 --- a/packages/google_maps_flutter/lib/src/google_maps_flutter_tizen.dart +++ b/packages/google_maps_flutter/lib/src/google_maps_flutter_tizen.dart @@ -53,6 +53,12 @@ class GoogleMapsPlugin extends GoogleMapsFlutterPlatform { _map(mapId).updateRawOptions(optionsUpdate); } + /// Updates the configuration of a given `mapId`. + @override + Future updateMapConfiguration(MapConfiguration configuration, {required int mapId}) async { + _map(mapId).updateRawOptions(_mapOptionsFromConfiguration(configuration)); + } + /// Applies the passed in `markerUpdates` to the `mapId`. @override Future updateMarkers(MarkerUpdates markerUpdates, {required int mapId}) async { diff --git a/packages/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/pubspec.yaml index 06cbba114..c39cc9d04 100644 --- a/packages/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_tizen description: Tizen implementation of the google_maps_flutter plugin. homepage: https://github.com/flutter-tizen/plugins repository: https://github.com/flutter-tizen/plugins/tree/main/packages/google_maps_flutter -version: 0.3.0 +version: 0.4.0 environment: sdk: ^3.10.0 From ad5f8ff5bdcaa1fe59c39c5c6e9af001c18323d4 Mon Sep 17 00:00:00 2001 From: Seungsoo Lee Date: Sun, 18 Oct 2026 04:57:16 +0900 Subject: [PATCH 2/9] [google_maps_flutter] Support webGestureHandling and fortyFiveDegreeImageryEnabled Implement the gesture handling and tilt control options added in google_maps_flutter_platform_interface 2.4.0, following google_maps_flutter_web 0.6.4+1 (_configurationAndStyleToGmapsOptions): webGestureHandling sets gestureHandling, falling back to the existing none/auto behavior when unset, and fortyFiveDegreeImageryEnabled sets rotateControl. --- packages/google_maps_flutter/CHANGELOG.md | 2 +- packages/google_maps_flutter/lib/src/convert.dart | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md index c932d838d..74c00dc40 100644 --- a/packages/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.4.0 -* Add support for `mapTypeControlEnabled`, `fullscreenControlEnabled`, `streetViewControlEnabled`, `webCameraControlEnabled`, and `webCameraControlPosition`. +* Add support for `mapTypeControlEnabled`, `fullscreenControlEnabled`, `streetViewControlEnabled`, `webCameraControlEnabled`, `webCameraControlPosition`, `webGestureHandling`, and `fortyFiveDegreeImageryEnabled`. ## 0.3.0 diff --git a/packages/google_maps_flutter/lib/src/convert.dart b/packages/google_maps_flutter/lib/src/convert.dart index 3faa20160..219b7a910 100644 --- a/packages/google_maps_flutter/lib/src/convert.dart +++ b/packages/google_maps_flutter/lib/src/convert.dart @@ -54,6 +54,9 @@ Map _mapOptionsFromConfiguration(MapConfiguration config) { if (config.mapId != null) 'mapId': config.mapId, if (config.style != null) 'style': config.style, if (config.colorScheme != null) 'colorScheme': config.colorScheme!.index, + if (config.webGestureHandling != null) 'webGestureHandling': config.webGestureHandling!.name, + if (config.fortyFiveDegreeImageryEnabled != null) + 'fortyFiveDegreeImageryEnabled': config.fortyFiveDegreeImageryEnabled, if (config.webCameraControlEnabled != null) 'webCameraControlEnabled': config.webCameraControlEnabled, if (config.webCameraControlPosition != null) @@ -138,13 +141,20 @@ String _rawOptionsToString(Map rawOptions) { options += ', cameraControlOptions: { position: google.maps.ControlPosition.$position }'; } + if (rawOptions['fortyFiveDegreeImageryEnabled'] != null) { + options += ', rotateControl: ${rawOptions['fortyFiveDegreeImageryEnabled']}'; + } + if (rawOptions['style'] != null && (rawOptions['style'] as String).isNotEmpty) { options += ', styles: ${rawOptions['style']}'; } else { options += ', styles: null'; } - if (rawOptions['scrollGesturesEnabled'] == false || rawOptions['zoomGesturesEnabled'] == false) { + if (rawOptions['webGestureHandling'] != null) { + options += ", gestureHandling: '${rawOptions['webGestureHandling']}'"; + } else if (rawOptions['scrollGesturesEnabled'] == false || + rawOptions['zoomGesturesEnabled'] == false) { options += ", gestureHandling: 'none'"; } else { options += ", gestureHandling: 'auto'"; From e0e092c8fe9b1eb8ccc1f7cd0824a3da53d350e5 Mon Sep 17 00:00:00 2001 From: Seungsoo Lee Date: Tue, 20 Oct 2026 04:08:52 +0900 Subject: [PATCH 3/9] [google_maps_flutter] Fix consumeTapEvents for circles, polygons, and polylines Circles, polygons, and polylines were created without the clickable option, so the JS map made them clickable by default. A shape with consumeTapEvents: false still swallowed taps and GoogleMap.onTap was never called for taps on it. Set clickable from consumeTapEvents, as google_maps_flutter_web does. Upstream: https://github.com/flutter/packages/pull/9838 (7ace630a87d6, google_maps_flutter_web 0.5.13) --- packages/google_maps_flutter/CHANGELOG.md | 1 + .../google_maps_flutter/lib/src/convert.dart | 9 ++++++--- packages/google_maps_flutter/lib/src/util.dart | 18 +++++++++++++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md index 74c00dc40..84d08b90c 100644 --- a/packages/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.4.0 * Add support for `mapTypeControlEnabled`, `fullscreenControlEnabled`, `streetViewControlEnabled`, `webCameraControlEnabled`, `webCameraControlPosition`, `webGestureHandling`, and `fortyFiveDegreeImageryEnabled`. +* Fix `consumeTapEvents` for circles, polygons, and polylines. ## 0.3.0 diff --git a/packages/google_maps_flutter/lib/src/convert.dart b/packages/google_maps_flutter/lib/src/convert.dart index 219b7a910..882a3b424 100644 --- a/packages/google_maps_flutter/lib/src/convert.dart +++ b/packages/google_maps_flutter/lib/src/convert.dart @@ -406,7 +406,8 @@ util.GPolylineOptions _polylineOptionsFromPolyline(Polyline polyline) { ..strokeOpacity = _getCssOpacity(polyline.color) ..visible = polyline.visible ..zIndex = polyline.zIndex - ..geodesic = polyline.geodesic; + ..geodesic = polyline.geodesic + ..clickable = polyline.consumeTapEvents; } util.GPolygonOptions _polygonOptionsFromPolygon(Polygon polygon) { @@ -438,7 +439,8 @@ util.GPolygonOptions _polygonOptionsFromPolygon(Polygon polygon) { ..fillOpacity = _getCssOpacity(polygon.fillColor) ..visible = polygon.visible ..zIndex = polygon.zIndex - ..geodesic = polygon.geodesic; + ..geodesic = polygon.geodesic + ..clickable = polygon.consumeTapEvents; } /// Calculates the direction of a given Polygon @@ -473,7 +475,8 @@ util.GCircleOptions _circleOptionsFromCircle(Circle circle) { ..center = LatLng(circle.center.latitude, circle.center.longitude) ..radius = circle.radius ..visible = circle.visible - ..zIndex = circle.zIndex; + ..zIndex = circle.zIndex + ..clickable = circle.consumeTapEvents; } util.GGroundOverlayOptions? _groundOverlayOptionsFromGroundOverlay(GroundOverlay groundOverlay) { diff --git a/packages/google_maps_flutter/lib/src/util.dart b/packages/google_maps_flutter/lib/src/util.dart index 2158c92c1..f08d63056 100644 --- a/packages/google_maps_flutter/lib/src/util.dart +++ b/packages/google_maps_flutter/lib/src/util.dart @@ -397,6 +397,9 @@ class GPolylineOptions { /// The zIndex compared to other polys. num? zIndex; + /// Whether click events are handled. + bool? clickable; + @override String toString() { final paths = StringBuffer(); @@ -407,7 +410,8 @@ class GPolylineOptions { } return '{geodesic:$geodesic, path:[$paths], strokeColor:${jsonEncode(strokeColor)},' - ' strokeOpacity:$strokeOpacity, map: map, strokeWeight:$strokeWeight, visible:$visible, zIndex:$zIndex}'; + ' strokeOpacity:$strokeOpacity, map: map, strokeWeight:$strokeWeight, visible:$visible, zIndex:$zIndex,' + ' clickable:$clickable}'; } } @@ -492,6 +496,9 @@ class GPolygonOptions { /// The zIndex compared to other polys. num? zIndex; + /// Whether click events are handled. + bool? clickable; + @override String toString() { final str = StringBuffer(); @@ -507,7 +514,8 @@ class GPolygonOptions { return '{fillColor:${jsonEncode(fillColor)}, fillOpacity:$fillOpacity, geodesic:$geodesic, paths:[$str],' ' strokeColor:${jsonEncode(strokeColor)}, strokeOpacity:$strokeOpacity, map: map,' - ' strokeWeight:$strokeWeight, visible:$visible, zIndex:$zIndex}'; + ' strokeWeight:$strokeWeight, visible:$visible, zIndex:$zIndex,' + ' clickable:$clickable}'; } } @@ -597,11 +605,15 @@ class GCircleOptions { /// The zIndex compared to other polys. num? zIndex; + /// Whether click events are handled. + bool? clickable; + @override String toString() { return '{center: new google.maps.LatLng(${center?.latitude}, ${center?.longitude}), fillColor:${jsonEncode(fillColor)},' ' fillOpacity:$fillOpacity, radius:$radius, strokeColor:${jsonEncode(strokeColor)}, strokeOpacity:$strokeOpacity,' - ' map: map, strokeWeight:$strokeWeight, visible:$visible, zIndex:$zIndex}'; + ' map: map, strokeWeight:$strokeWeight, visible:$visible, zIndex:$zIndex,' + ' clickable:$clickable}'; } } From fdc5325d63291b78a4d2857bcb92a53691f0f0cb Mon Sep 17 00:00:00 2001 From: Seungsoo Lee Date: Tue, 20 Oct 2026 04:21:31 +0900 Subject: [PATCH 4/9] [google_maps_flutter] Fix initial geometry being added twice GoogleMapsController.init() is called eagerly by buildView and again by GoogleMapsPlugin.init(). The second call skipped map creation but rendered the initial markers, circles, polygons, polylines, ground overlays, and marker clusterers again. The second set replaced the first in the controllers, so the first set stayed on the map for good: removing an initial circle left a copy of it behind. Run the initialization once and let later calls wait for it. google_maps_flutter_web avoids the same problem by leaving GoogleMapsPlugin.init() empty. --- packages/google_maps_flutter/CHANGELOG.md | 1 + .../lib/src/google_maps_controller.dart | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md index 84d08b90c..501333c13 100644 --- a/packages/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/CHANGELOG.md @@ -2,6 +2,7 @@ * Add support for `mapTypeControlEnabled`, `fullscreenControlEnabled`, `streetViewControlEnabled`, `webCameraControlEnabled`, `webCameraControlPosition`, `webGestureHandling`, and `fortyFiveDegreeImageryEnabled`. * Fix `consumeTapEvents` for circles, polygons, and polylines. +* Fix initial map objects being added to the map twice. ## 0.3.0 diff --git a/packages/google_maps_flutter/lib/src/google_maps_controller.dart b/packages/google_maps_flutter/lib/src/google_maps_controller.dart index 0fabc520a..b46f8c3d9 100644 --- a/packages/google_maps_flutter/lib/src/google_maps_controller.dart +++ b/packages/google_maps_flutter/lib/src/google_maps_controller.dart @@ -433,7 +433,13 @@ class GoogleMapsController { /// /// Failure to call this method would result in not rendering at all, /// and most of the public methods on this class no-op'ing. - Future init() async { + /// + /// Later calls return the same future. + Future init() => _initFuture ??= _init(); + + Future? _initFuture; + + Future _init() async { if (_webview == null && !_streamController.isClosed) { _getWebview(); if (!await _bridge.load()) { From 3462f436d945a8f9ec4af1992c840c5859bdae19 Mon Sep 17 00:00:00 2001 From: Seungsoo Lee Date: Thu, 22 Oct 2026 05:01:13 +0900 Subject: [PATCH 5/9] [google_maps_flutter] Fix onMapCreated hanging when tiles fail to load The map was reported as ready only on the first `tilesloaded` event, which requires every visible tile to finish downloading. A single stalled or failed tile request left `onMapCreated` pending forever. Also report the map as ready on the first `idle` event once the map div has a non-zero size, as google_maps_flutter_web does. Upstream: https://github.com/flutter/packages/pull/13059 (google_maps_flutter_web 0.6.4+2, flutter/flutter#193452) --- packages/google_maps_flutter/CHANGELOG.md | 1 + .../lib/src/google_maps_controller.dart | 22 ++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md index 501333c13..bde5ecf91 100644 --- a/packages/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/CHANGELOG.md @@ -3,6 +3,7 @@ * Add support for `mapTypeControlEnabled`, `fullscreenControlEnabled`, `streetViewControlEnabled`, `webCameraControlEnabled`, `webCameraControlPosition`, `webGestureHandling`, and `fortyFiveDegreeImageryEnabled`. * Fix `consumeTapEvents` for circles, polygons, and polylines. * Fix initial map objects being added to the map twice. +* Fix `onMapCreated` never being called when a map tile request stalls or fails. ## 0.3.0 diff --git a/packages/google_maps_flutter/lib/src/google_maps_controller.dart b/packages/google_maps_flutter/lib/src/google_maps_controller.dart index b46f8c3d9..3ebe9653f 100644 --- a/packages/google_maps_flutter/lib/src/google_maps_controller.dart +++ b/packages/google_maps_flutter/lib/src/google_maps_controller.dart @@ -139,9 +139,9 @@ class GoogleMapsController { case MapsJsEventType.boundsChanged: await _onBoundsChanged(); case MapsJsEventType.idle: - _onIdle(); + await _onIdle(); case MapsJsEventType.tilesLoaded: - _onTilesloaded(); + _onMapReady(); case MapsJsEventType.click: _onClick(event.message!); case MapsJsEventType.longPress: @@ -215,14 +215,26 @@ class GoogleMapsController { } } - void _onIdle() { + Future _onIdle() async { _mapIsMoving = false; _streamController.add(CameraIdleEvent(_mapId)); + // NOTE: `tilesloaded` never fires if a tile request stalls or fails. + // See https://github.com/flutter/flutter/issues/193452. + if (!_isFirst && await _isMapLaidOut()) { + _onMapReady(); + } + } + + Future _isMapLaidOut() async { + final Object value = await _bridge.runJavaScriptReturningResult( + 'map.getDiv().offsetWidth > 0 && map.getDiv().offsetHeight > 0', + ); + return value.toString() == 'true'; } - void _onTilesloaded() { + void _onMapReady() { try { - if (_isFirst) { + if (_isFirst || _streamController.isClosed) { return; } _streamController.add(MapReadyEvent(_mapId)); From 7d745245618a378233f0fb30b40a4e63956f6154 Mon Sep 17 00:00:00 2001 From: Seungsoo Lee Date: Sat, 24 Oct 2026 04:30:24 +0900 Subject: [PATCH 6/9] [google_maps_flutter] Fix map events with integer coordinates being dropped Coordinates sent from the JavaScript side are decoded with json.decode, which yields an int for a whole number such as 3 or -20. The handlers cast them with `as double`, so a tap, long press, marker drag, or cluster tap at such a position threw a cast error that was only logged, and the event was never delivered. The visible region had the same cast. Convert the decoded numbers through `num`, as _convertToLatLng already does. --- packages/google_maps_flutter/CHANGELOG.md | 1 + .../google_maps_flutter/lib/src/convert.dart | 12 +++++----- .../lib/src/google_maps_controller.dart | 22 ++++++++++++------- .../lib/src/marker_clustering.dart | 12 +++++----- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md index bde5ecf91..28940746f 100644 --- a/packages/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/CHANGELOG.md @@ -4,6 +4,7 @@ * Fix `consumeTapEvents` for circles, polygons, and polylines. * Fix initial map objects being added to the map twice. * Fix `onMapCreated` never being called when a map tile request stalls or fails. +* Fix map events being dropped when the reported coordinates are integers. ## 0.3.0 diff --git a/packages/google_maps_flutter/lib/src/convert.dart b/packages/google_maps_flutter/lib/src/convert.dart index 882a3b424..0ce394c00 100644 --- a/packages/google_maps_flutter/lib/src/convert.dart +++ b/packages/google_maps_flutter/lib/src/convert.dart @@ -256,14 +256,14 @@ LatLngBounds _convertToBounds(String value) { final dynamic bound = json.decode(value); if (bound is Map) { assert( - bound['south'] is double && - bound['west'] is double && - bound['north'] is double && - bound['east'] is double, + bound['south'] is num && + bound['west'] is num && + bound['north'] is num && + bound['east'] is num, ); return LatLngBounds( - southwest: LatLng(bound['south'] as double, bound['west'] as double), - northeast: LatLng(bound['north'] as double, bound['east'] as double), + southwest: LatLng((bound['south'] as num).toDouble(), (bound['west'] as num).toDouble()), + northeast: LatLng((bound['north'] as num).toDouble(), (bound['east'] as num).toDouble()), ); } } catch (e) { diff --git a/packages/google_maps_flutter/lib/src/google_maps_controller.dart b/packages/google_maps_flutter/lib/src/google_maps_controller.dart index 3ebe9653f..4499488e0 100644 --- a/packages/google_maps_flutter/lib/src/google_maps_controller.dart +++ b/packages/google_maps_flutter/lib/src/google_maps_controller.dart @@ -249,7 +249,10 @@ class GoogleMapsController { final dynamic event = json.decode(message); if (event is Map) { assert(event['latLng'] != null); - final position = LatLng(event['latLng']['lat'] as double, event['latLng']['lng'] as double); + final position = LatLng( + (event['latLng']['lat'] as num).toDouble(), + (event['latLng']['lng'] as num).toDouble(), + ); _streamController.add(MapTapEvent(_mapId, position)); } } catch (e) { @@ -262,7 +265,10 @@ class GoogleMapsController { final dynamic event = json.decode(message); if (event is Map) { assert(event['latLng'] != null); - final position = LatLng(event['latLng']['lat'] as double, event['latLng']['lng'] as double); + final position = LatLng( + (event['latLng']['lat'] as num).toDouble(), + (event['latLng']['lng'] as num).toDouble(), + ); _streamController.add(MapLongPressEvent(_mapId, position)); } } catch (e) { @@ -314,8 +320,8 @@ class GoogleMapsController { final MarkerController? marker = _markersController!._markerIdToController[markerId]; final position = LatLng( - result['event']['latLng']['lat'] as double, - result['event']['latLng']['lng'] as double, + (result['event']['latLng']['lat'] as num).toDouble(), + (result['event']['latLng']['lng'] as num).toDouble(), ); if (marker?.dragStartEvent != null) { @@ -338,8 +344,8 @@ class GoogleMapsController { final MarkerController? marker = _markersController!._markerIdToController[markerId]; final position = LatLng( - result['event']['latLng']['lat'] as double, - result['event']['latLng']['lng'] as double, + (result['event']['latLng']['lat'] as num).toDouble(), + (result['event']['latLng']['lng'] as num).toDouble(), ); if (marker?.dragEvent != null) { @@ -362,8 +368,8 @@ class GoogleMapsController { final MarkerController? marker = _markersController!._markerIdToController[markerId]; final position = LatLng( - result['event']['latLng']['lat'] as double, - result['event']['latLng']['lng'] as double, + (result['event']['latLng']['lat'] as num).toDouble(), + (result['event']['latLng']['lng'] as num).toDouble(), ); if (marker?.dragEndEvent != null) { diff --git a/packages/google_maps_flutter/lib/src/marker_clustering.dart b/packages/google_maps_flutter/lib/src/marker_clustering.dart index 2df839e34..365a3276d 100644 --- a/packages/google_maps_flutter/lib/src/marker_clustering.dart +++ b/packages/google_maps_flutter/lib/src/marker_clustering.dart @@ -144,18 +144,18 @@ class ClusterManagersController extends GeometryController { Map markerClustererCluster, ) { final position = LatLng( - (markerClustererCluster['position'] as dynamic)['lat'] as double, - (markerClustererCluster['position'] as dynamic)['lng'] as double, + ((markerClustererCluster['position'] as dynamic)['lat'] as num).toDouble(), + ((markerClustererCluster['position'] as dynamic)['lng'] as num).toDouble(), ); final bounds = LatLngBounds( southwest: LatLng( - (markerClustererCluster['bounds'] as dynamic)['south'] as double, - (markerClustererCluster['bounds'] as dynamic)['west'] as double, + ((markerClustererCluster['bounds'] as dynamic)['south'] as num).toDouble(), + ((markerClustererCluster['bounds'] as dynamic)['west'] as num).toDouble(), ), northeast: LatLng( - (markerClustererCluster['bounds'] as dynamic)['north'] as double, - (markerClustererCluster['bounds'] as dynamic)['east'] as double, + ((markerClustererCluster['bounds'] as dynamic)['north'] as num).toDouble(), + ((markerClustererCluster['bounds'] as dynamic)['east'] as num).toDouble(), ), ); From e56423579a17bdfa2f84a92be1b6a36cafa64362 Mon Sep 17 00:00:00 2001 From: Seungsoo Lee Date: Sat, 24 Oct 2026 04:30:24 +0900 Subject: [PATCH 7/9] [google_maps_flutter] Fix initial cluster managers being ignored buildViewWithConfiguration did not pass mapObjects.clusterManagers to GoogleMapsController, so the cluster managers given to the initial GoogleMap were never created: their markers were drawn one by one and onClusterTap never fired. The controller also added the initial markers before the cluster managers, so even a passed-in cluster manager would not have received its initial markers. Pass the cluster managers through and create them before the initial geometry, as google_maps_flutter_web does. Upstream reference: google_maps_flutter_web GoogleMapController (clusterManagers from mapObjects, _initClustering before _renderInitialGeometry). --- packages/google_maps_flutter/CHANGELOG.md | 1 + .../google_maps_flutter/lib/src/google_maps_controller.dart | 4 ++-- .../lib/src/google_maps_flutter_tizen.dart | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md index 28940746f..843b61768 100644 --- a/packages/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/CHANGELOG.md @@ -5,6 +5,7 @@ * Fix initial map objects being added to the map twice. * Fix `onMapCreated` never being called when a map tile request stalls or fails. * Fix map events being dropped when the reported coordinates are integers. +* Fix cluster managers passed to the initial `GoogleMap` being ignored. ## 0.3.0 diff --git a/packages/google_maps_flutter/lib/src/google_maps_controller.dart b/packages/google_maps_flutter/lib/src/google_maps_controller.dart index 4499488e0..b1661a32e 100644 --- a/packages/google_maps_flutter/lib/src/google_maps_controller.dart +++ b/packages/google_maps_flutter/lib/src/google_maps_controller.dart @@ -469,6 +469,8 @@ class GoogleMapsController { await _createMap(); } await _attachGeometryControllers(); + _initClustering(_clusterManagers); + _renderInitialGeometry( markers: _markers, circles: _circles, @@ -477,8 +479,6 @@ class GoogleMapsController { groundOverlays: _groundOverlays, ); - _initClustering(_clusterManagers); - await _setTrafficLayer(_isTrafficLayerEnabled(_rawMapOptions)); } diff --git a/packages/google_maps_flutter/lib/src/google_maps_flutter_tizen.dart b/packages/google_maps_flutter/lib/src/google_maps_flutter_tizen.dart index ad9e7aa83..46b8a35d4 100644 --- a/packages/google_maps_flutter/lib/src/google_maps_flutter_tizen.dart +++ b/packages/google_maps_flutter/lib/src/google_maps_flutter_tizen.dart @@ -295,6 +295,7 @@ class GoogleMapsPlugin extends GoogleMapsFlutterPlatform { polygons: mapObjects.polygons, polylines: mapObjects.polylines, circles: mapObjects.circles, + clusterManagers: mapObjects.clusterManagers, groundOverlays: mapObjects.groundOverlays, gestureRecognizers: widgetConfiguration.gestureRecognizers, mapOptions: _mapOptionsFromConfiguration(mapConfiguration), @@ -336,6 +337,7 @@ class GoogleMapsPlugin extends GoogleMapsFlutterPlatform { Set polygons = const {}, Set polylines = const {}, Set circles = const {}, + Set clusterManagers = const {}, Set groundOverlays = const {}, Set>? gestureRecognizers = const >{}, @@ -356,6 +358,7 @@ class GoogleMapsPlugin extends GoogleMapsFlutterPlatform { polygons: polygons, polylines: polylines, circles: circles, + clusterManagers: clusterManagers, groundOverlays: groundOverlays, mapOptions: mapOptions, )..init(); // Initialize the controller From 4d5322cff335204602d24026c770232bed4d7af3 Mon Sep 17 00:00:00 2001 From: Seungsoo Lee Date: Sat, 24 Oct 2026 04:47:32 +0900 Subject: [PATCH 8/9] [google_maps_flutter] Fix Cluster.markerIds holding internal ids The cluster click event carries the `id` property of each JS marker, which is the internal GMarker counter, and _convertCluster turned it into MarkerId('0'), MarkerId('1') and so on. onClusterTap therefore reported marker ids that the app never created. Map the internal ids back to the markers' MarkerIds through MarkersController, as the marker click and drag handlers already do. google_maps_flutter_web builds Cluster.markerIds from the MarkerId stored on each marker (getMarkerId). --- packages/google_maps_flutter/CHANGELOG.md | 1 + .../lib/src/google_maps_controller.dart | 1 + .../google_maps_flutter/lib/src/marker_clustering.dart | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md index 843b61768..0060fcce1 100644 --- a/packages/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/CHANGELOG.md @@ -6,6 +6,7 @@ * Fix `onMapCreated` never being called when a map tile request stalls or fails. * Fix map events being dropped when the reported coordinates are integers. * Fix cluster managers passed to the initial `GoogleMap` being ignored. +* Fix `Cluster.markerIds` holding internal ids instead of the markers' `MarkerId`s. ## 0.3.0 diff --git a/packages/google_maps_flutter/lib/src/google_maps_controller.dart b/packages/google_maps_flutter/lib/src/google_maps_controller.dart index b1661a32e..d7210e4c4 100644 --- a/packages/google_maps_flutter/lib/src/google_maps_controller.dart +++ b/packages/google_maps_flutter/lib/src/google_maps_controller.dart @@ -37,6 +37,7 @@ class GoogleMapsController { _clusterManagersController = ClusterManagersController( stream: _streamController, bridge: _bridge, + markerIdForId: (int id) => _markersController?._idToMarkerId[id], ); _markersController = MarkersController( stream: _streamController, diff --git a/packages/google_maps_flutter/lib/src/marker_clustering.dart b/packages/google_maps_flutter/lib/src/marker_clustering.dart index 365a3276d..b1087cb99 100644 --- a/packages/google_maps_flutter/lib/src/marker_clustering.dart +++ b/packages/google_maps_flutter/lib/src/marker_clustering.dart @@ -18,8 +18,10 @@ class ClusterManagersController extends GeometryController { ClusterManagersController({ required StreamController> stream, required GoogleMapsJsBridge bridge, + required MarkerId? Function(int id) markerIdForId, }) : _streamController = stream, _bridge = bridge, + _markerIdForId = markerIdForId, _idToClusterManagerId = {}, _clusterManagerIdToMarkerClusterer = {}; @@ -28,6 +30,8 @@ class ClusterManagersController extends GeometryController { final GoogleMapsJsBridge _bridge; + final MarkerId? Function(int id) _markerIdForId; + // A cache of [MarkerClusterer]s indexed by their [ClusterManagerId]. final Map _clusterManagerIdToMarkerClusterer; final Map _idToClusterManagerId; @@ -160,7 +164,8 @@ class ClusterManagersController extends GeometryController { ); final List markerIds = (markerClustererCluster['markers']! as List) - .map((dynamic markerId) => MarkerId((markerId as int).toString())) + .map((dynamic id) => _markerIdForId(id as int)) + .nonNulls .toList(); return Cluster(clusterManagerId, markerIds, position: position, bounds: bounds); From 021d76d089f630d2a91e281cb488ae6c3c66ccb7 Mon Sep 17 00:00:00 2001 From: Seungsoo Lee Date: Fri, 6 Nov 2026 15:09:28 +0900 Subject: [PATCH 9/9] [google_maps_flutter] Fix getZoomLevel type cast error during teardown A `bounds_changed` event still being handled when the map is disposed calls `getZoom` on a webview that is being torn down, which returns '' instead of a number. The `as num` cast then threw and logged "type 'String' is not a subtype of type 'num'". Return 0.0 for non-numeric results instead of casting. --- .../google_maps_flutter/lib/src/google_maps_controller.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/lib/src/google_maps_controller.dart b/packages/google_maps_flutter/lib/src/google_maps_controller.dart index d7210e4c4..62db01b00 100644 --- a/packages/google_maps_flutter/lib/src/google_maps_controller.dart +++ b/packages/google_maps_flutter/lib/src/google_maps_controller.dart @@ -613,7 +613,9 @@ class GoogleMapsController { Future _getZoom() async { try { - return (await _callMethod('getZoom', []) as num) + 0.0; + // NOTE: Returns '' if called while the webview is being torn down. + final Object zoom = await _callMethod('getZoom', []); + return zoom is num ? zoom.toDouble() : 0.0; } catch (e) { debugPrint('JavaScript Error: $e'); return 0.0;