generic_map 0.15.0
generic_map: ^0.15.0 copied to clipboard
A generic maps api supporting Google Maps, Mapbox, OpenStreetMaps and MapLibre
Changelog #
0.15.0 - 2026-10-04 #
A camera that can face a direction and lean, for following a vehicle.
- feat:
MapViewController.setCamera(MapViewCamera, {Duration? duration}).MapViewCamerais a centre, an optional zoom, abearing(degrees clockwise from north that the top of the map points) and atilt.moveCameraandfitBoundsare unchanged and still leave the map north up and flat. With adurationthe camera travels there over that time, so a host calling it once a second with a one-second duration follows a moving position without a jump between fixes;Duration.zeroplaces it at once.- Google Maps:
CameraUpdate.newCameraPosition, animated overduration. - flutter_map: rotation animated linearly alongside the move. It draws a
flat map, so
tiltis ignored. - Mapbox SDK:
easeTowith bearing and pitch.
- Google Maps:
- feat:
MapMovedEvent.bearing, the direction the top of the map points when the event fired. It defaults to 0, so hosts that buildMapMovedEvents themselves are unaffected. A host needs it to draw a compass, and to know the user turned the map by hand. - feat:
CustomMarker.flat. A flat marker lies on the map and turns with it, so itsrotationis a compass heading that stays true when the camera faces another way — what a vehicle seen from above needs once the map can be turned. The default,false, is a marker that stands upright. Google Maps and flutter_map; the Mapbox SDK draws every marker upright. - fix: on flutter_map an upright marker tipped over when the map was turned. Markers were drawn turned with the map, so a pin lay on its side after a two-finger rotate. They are now turned back, as on Google Maps.
setCameramoves are attributed asMapMoveSource.programmatic, likemoveCameraandfitBounds, so a follow can still tell its own steps from the user taking the map over.
Breaking for implementers only: MapViewController gained an abstract
method. A class that implements it has to add setCamera; code that only
calls a controller is unaffected.
0.14.0 - 2026-09-02 #
MapMovedEvent now says what moved the camera, not just where in the
movement the event sits.
- feat:
MapMovedEvent.source(MapMoveSource.gesture/programmatic/unknown), withisUserGestureandisProgrammaticshorthands. It is a new field rather than a newMapMoveEventTypevalue on purpose: the lifecycle and the cause are orthogonal, and hosts switching exhaustively overMapMoveEventTypekeep compiling. The field defaults toMapMoveSource.unknown, so hosts that buildMapMovedEvents themselves are unaffected. Without it, anything that follows a moving position cancels itself: the follow moves the camera, the move comes back as an ordinarystart, and "the map moved" gets read as "the user panned". - feat:
MapMoveAttribution, mixed intoGoogleMapsControllerandMapboxController. Those SDKs report that the camera moved and nothing about why, so a move is attributed to the app from themoveCamera/fitBoundscall until the camera next settles, and to the user otherwise. A camera call that produces no events at all — moving to where the camera already is — stops shadowing later gestures after a few seconds. flutter_map reports its ownMapEventSourceand is mapped straight across. - Both
unknowncases are honest ones: a map that has never come to rest (the initial camera settling), and flutter_map's viewport/interaction-flag changes. - fix: Google Maps reported no map movement at all outside
MapViewMode.picker. The camera position the move callbacks report was only tracked when the mode waspicker, soonCameraMoveStartedandonCameraIdleboth bailed out before callingonMapMoved— a static map following a position never heard that it had moved. It is now seeded from the initial camera and tracked in every mode. - fix: a movement starting again no longer leaves the previous movement's idle debounce armed. It fired mid-drag with the new movement's start snapshot, reporting a resting position the camera never rested at and arming address resolution while the finger was still down.
- fix: overlapping Mapbox camera changes leaked debounce timers — the cancel
ran before an
awaitand the assignment after it, so two changes interleaving across that await left the first timer running to fire a stale idle. It also settled attribution mid-movement, reporting the rest of the app's own camera move as a user gesture. - fix:
MapboxController.fitBoundsread the controller completer twice, against the single-read rulemoveCameradocuments: a platform view recreated between the two reads applied a camera computed for one map to another. - Breaking for direct users of the provider widgets only:
onMapMovedonGoogleMapView,FlutterMapView,MapBoxViewandMapLibreViewis nowMapMovedCallback—void Function(MapMovedEvent), the same shape asGenericMap.onMapMoved— instead of four positional pieces of a camera event that the caller reassembled.GenericMap.onMapMovedis unchanged.
0.13.0 - 2026-08-20 #
Crash fixes around platform view recreation. Minor rather than patch: the
controllers gained public API and GoogleMapsController.dispose changed which
object it owns.
- fix:
GoogleMapViewno longer throwsBad state: Future already completedwhen the platform view is recreated.onMapCreatedfires once per platform view, not once perGoogleMapsController: a remountedGoogleMapbuilds a new native map while the state owning the controller lives on, and the secondcomplete()threw. Controllers are now handed over withGoogleMapsController.attach, which swaps in a fresh completer instead. - fix: after such a recreation the completer kept handing out the previous
platform controller, whose
GoogleMapis unmounted — every method on it throwsGoogleMapController for map ID N was used after the associated GoogleMap widget had already been disposed.attachnow swaps the live controller in. - fix: camera calls against a map that is already gone are dropped and logged
rather than thrown — a host debounce timer firing after a screen pops, say.
Covers all three shapes this takes:
StateErrorfrom the controller's own mounted check, the release-mode null-checkTypeErrorfrom the web platform's map registry, andMissingPluginExceptionfrom a torn-down method channel. - fix:
GoogleMapsController.disposeno longer disposes the platform controller.GoogleMapowns it and disposes it from its ownState.dispose; doing it twice removed the map from the web registry and then failed a null check on the second pass. It also releases any camera call still waiting on a map that will now never be created. - fix:
onMapCreatedrebuilds the marker, circle, polyline and heatmap sets instead of appending to them. The tail of that callback was unreachable on a second platform view until now (the throw above cut it short); appending would have stacked a second marker under every id, since a re-parsed marker carries a freshly generatedBitmapDescriptorand those compare by identity. - fix: circles, polylines and heatmaps set up in
onMapCreatedare applied insidesetState, so a map opened with circles or a heatmap but no markers paints them without waiting for an unrelated rebuild. - fix:
setState() called after dispose()when the screen was popped while marker bitmaps were still rendering, inonMapCreatedand in the marker update path. GoogleMapsControllergainedgetCenterOrNull/getViewportBoundsOrNull, which return null instead of throwing when there is no live map. The library's own camera callbacks use them.GoogleMapsController.mapControllerandMapboxController.mapControllerare deprecated. Readcontrollerinstead; hand maps over withattach.- fix (Mapbox SDK): the same unguarded
complete(), nowattach; the camera debounce timer is cancelled when the widget unmounts instead of firing 500ms later against a destroyed map;MapboxController.disposeno longer disposes theMapboxMapthatMapWidgetalready owns;moveCamerareads the completer once so a recreation mid-call cannot apply the camera to a different map than the zoom was read from.
0.12.0 - 2026-08-12 #
- fix: the map no longer resets its camera on unrelated rebuilds. None of the
options classes carried value equality, but consumers build them inline from
a theme flag (
isDark ? dark : light), so a new-but-identical instance arrived on every rebuild.GoogleMapViewcompares options with!=indidUpdateWidget, which without==was an identity check, so every rebuild read as a style change and reloaded the style. In dark mode that path renderedSizedBox.shrink(), unmounting theGoogleMapand remounting it atinitialCameraPosition. Added==/hashCodetoGoogleMapsOptions,MapLibreOptions,MapboxOptions,MapboxSdkOptions,OpenStreetMapsOptionsandPlatformMapProviderSettings. - fix: a style reload keeps the map mounted. Only the first load may blank,
since only then is there nothing to preserve —
GoogleMaptakesstyleas a parameter, so a swap needs no remount. This also fixes the camera reset on a genuine light/dark toggle. - fix: circle and polyline lists are compared element-wise rather than by
identity, and
CircleMarkergained the value equalityCustomMarkerandPolyLineLayeralready had. Both update paths previously calledsetStatefromdidUpdateWidgeton every rebuild.
0.11.4 - 2026-07-12 #
- fix: OpenStreetMap/Mapbox raster map no longer turns into a black screen when zoomed in past level 19. The camera
maxZoomwas 20 while the tile layers only render up tomaxZoom: 19, so flutter_map hid the whole tile layer past that point. Capped the camera at 19 to match the tile coverage.
0.11.1 - 2026-04-12 #
- fix: Google Maps style presets now apply correctly (was rendering unstyled due to async race)
- fix:
cloudMapIdandpreset/customStyleJsonno longer conflict when both are set - fix: Replaced deprecated
cloudMapIdwithmapIdforgoogle_maps_fluttercompatibility
0.11.0 - 2026-04-12 #
- feat: Editable polylines and polygons for Google Maps (web) via native JS
editableAPI - feat:
PolyLineLayernow supportsidandeditablefields - feat:
onPolylineEditedcallback onGenericMapfor receiving edit events with polyline ID and updated points - feat:
isPolylineDrawEnabledandonPolylineDrawnnow work with Google Maps provider (marks polylines as editable on web) - dependency: Uses forked
google_maps_flutterwith editable shape support (PR flutter/packages#11492)
0.10.3 - 2025-11-13 #
- feat: Added dark mode support for Google Maps with predefined style presets (dark, silver, retro, night, aubergine)
- feat: Added
GoogleMapStylePresetenum for easy theme switching - feat: Support for custom JSON styles and cloud-based map IDs in GoogleMapsOptions
- improved: Google Maps now has feature parity with other providers for styling/theming
- updated: Example app demonstrates dark mode toggle for all providers
0.10.0 - 2025-09-18 #
- feat: Added stable marker ids to ensure markers maintain their identity across updates.
0.9.18 - 2025-09-02 #
- feat: Added more robust map movement handling for various cases (Debounce supported now)
- fix: Race condition in address resolution
- deprecated: isStart property in MapMovedEvent
0.9.17 - 2025-09-01 #
- feat: Added debounce timer on address resolution
0.9.14 - 2025-08-31 #
- feat: Added getViewportBounds to the controller.
0.9.13 - 2025-08-31 #
- set max zoom level on fit bounds to prevent over-zooming
0.9.10 - 2025-07-31 #
- fix: Consider MapEventFlingAnimation & zoom events in the map event handling to ensure proper map interaction tracking.
0.9.9 - 2025-07-23 #
- fix: Disabled MapLibre integration to resolve WASM build compatibility issues affecting applications that depend on generic_map.
0.9.7 - 2025-07-22 #
- upgraded flutter_map to 8.2.2 again, fixing web issues with the previous version.
- fixed: Web platform now allowed with Google Maps.
0.9.4 - 2025-07-21 #
- rolled back flutter_map to 8.1.1 due to web issues with the latest version.
0.9.0 - 2025-07-20 #
- New: Introduced more robust
MapMovedEventclass with additionalboundsfield for enhanced map interaction tracking.
0.8.10 - 2025-07-17 #
- deps: Updated flutter_map to 8.2.1
- improved: Removed flutter_map_cancellable_tile_provider as it is no longer needed with the latest flutter_map version. HTTP package now supports cancellation natively.
- fix: Updated mapbox_maps_flutter to 2.9.1.
0.8.9 - 2025-06-27 #
- fix: Limit open street maps & mapbox static tile layer to zoom level 19
- fix: Disabled showing my location on the flutter_map for now as it interferes with location retrieval on iOS real devices.
0.8.7 - 2025-06-24 #
- fix: fix race condition in Google Maps provider that caused some markers to not to be displayed correctly.
- updated: mapbox_maps_flutter to 2.9.0
0.8.5 - 2025-06-09 #
- fix: Some google Maps drawing issues
0.8.4 - 2025-06-05 #
- chore: Updated maplibre_gl to 0.22.0 which brings Flutter 3.32.0 compatibility.
0.8.3 - 2025-06-05 #
- fixed: Google Maps and Maplibre now correctly handle movement gestures.
0.8.0 - 2025-05-22 #
- Added heatmap support to Google Maps.
- Fixed some marker drawing accuracy issues.
- Added actionsPadding parameter for Mapbox and Google Maps logos.
0.7.3 - 2025-05-18 #
- Added heatmap support to Mapbox SDK, OSM, Mapbox Static and MapLibre providers. (Google Maps provider does not support heatmaps)
- Extensive styling options for heatmaps, including color gradients and radius.
0.6.7 - 2025-05-16 #
- For providers that lack widget support, it prefers drawing using fallbackImagePath to achieve better performance. If fallbackImagePath is not set, it draws the widget on a canvas and then converts it to an image.
- Image resizing correctly respects the device pixel ratio.
- Mapbox SDK styles are more accessible now through an enum.
0.6.6 - 2025-05-14 #
- Added initial zoom level to the map provider settings
- Various bug fixes and improvements
0.6.3 - 2025-03-24 #
- Add copyWith, fromJson, toJson, toString, equality, and hashCode methods to Place class
0.6.2 - 2025-03-01 #
- Some fixes to widget as marker
0.6.1 - 2025-03-01 #
- Add assertions to ensure that the map provider is supported on the platform
0.6.0 - 2025-03-01 #
- Refactor the map provider settings to be more flexible
- Per-platform map provider settings are now available
- Provider specific options are now available
- Updated code to use newer Dart syntax for improved readability
0.5.0 - 2025-02-27 #
- Add support for MapLibre
- Update flutter_map to 8.1.0
0.4.1 - 2025-02-16 #
- Update flutter_map and it's dependencies to 8.0.0
0.4.0 - 2025-02-08 #
- Add support for Official MapBox Maps
0.3.5 - 2025-01-13 #
- Bump flutter_map_tile_caching to 10.0.0
- Bump google_maps_flutter to 2.10.0
- Bump flutter_map_animations to 0.8.0
0.3.3 - 2024-11-27 #
- Adjust polyline color to the theme's primary color
0.3.2 - 2024-11-27 #
- Revert latlng export to generic_map.dart due to conflicted export with Path
- Polyline color is retrieved from the theme's primary color
0.3.1 - 2024-11-27 #
- Add latlng export to generic_map.dart