maplibre_gl_web 0.27.0
maplibre_gl_web: ^0.27.0 copied to clipboard
Web platform implementation of maplibre_gl. This package is only intended to be used by the maplibre_gl package.
See the top-level CHANGELOG for full details.
0.27.0 #
Added #
queryCameraPosition()is implemented; it used to throwUnimplementedError(#892).updateContentInsets()and the newsetPadding()are implemented through the camerapaddingoption; both used to throwUnimplementedError(#258).getLayerProperties()andgetSourceProperties()read a layer's or source's properties from the live style, in the same shape as Android and iOS (#513).- The manual location puck is drawn by the plugin, since maplibre-gl-js has no injectable location component. It reuses maplibre-gl-js' own user-location classes plus a bearing arrow, so it needs
maplibre-gl.css. The plugin loads that with the library (#840). - The plugin loads maplibre-gl-js itself before the first map is built. It loads the build its interop is written against, or whatever
MapLibreMap.webLibrarySourceconfigures, and reuses an existingmaplibreglglobal as it is. A failed stylesheet only logs, since it affects the controls and the puck, not the map. A failed import is not memoized, so the next map build retries (#928). MapLibreGlobalWebimplements the newMapLibreGlobalPlatformat plugin registration, which is howMapLibreMap.preWarm()andMapLibreMap.ensureWebLibraryLoaded()get their web behaviour (#928).getClusterExpansionZoom(),getClusterChildren()andgetClusterLeaves()read a clustered GeoJSON source. maplibre-gl-js 6 returns promises from all three, where version 5 took a trailing callback, so the interop is typed as promises. The library rejects on a source that is not clustered or an unknown cluster id.getClusterChildren()andgetClusterLeaves()report that as an empty list, matching Android and iOS;getClusterExpansionZoom()raisesCLUSTER_NOT_FOUND, since 0 is a valid zoom and a caller could not tell it from a real answer (#896).setTrackingCameraOptions()throws anUnsupportedErrornaming the platform, since maplibre-gl-js has no location component.GeolocateControlstops following the user on any programmatic camera change it did not make itself, and firestrackuserlocationend, which this package forwards as a tracking dismissal. Suppressing those events would report tracking that is no longer happening (#888).
Fixed #
getFeatureState()returns the state instead of throwing, and reports no state as null rather than as an empty map, matching Android. It converted the JS object withdartify()and cast the result toMap<String, dynamic>, which that conversion never produces, so every call that found a state threw (#889).removeFeatureState(sourceId)with no feature id resets the whole source. It built the target withid: null, and maplibre-gl-js only treats a missing id as "every feature of this source", so the call cleared nothing without an error. AstateKeywith nofeatureIdnow raises the sameINVALID_ARGUMENTas Android instead of being ignored (#889).onMapIdlenow fires, matching Android and iOS; code waiting on it never ran (#857).querySourceFeatures()raisesSTYLE_NOT_READYwhen the style has not loaded yet. It used to log and answer with an empty list, which the caller cannot tell apart from a source holding no features. The twoqueryRenderedFeaturescalls keep answering with an empty list, since nothing is rendered yet either way (#952).queryRenderedFeaturesInRect()decodes the JSON string filter before handing it to maplibre-gl-js, which accepts only the expression itself. The filter was ignored, so the call answered with every feature in the rectangle (#953).
Changed #
- The pinned maplibre-gl-js build is 6.4.1. Over 6.2 it fixes a permanent frame-rate drop after a style switch, a rejected missing-image resolver taking the rest of its batch down with it, globe zoom drifting away from the pointer and globe panning stalling at the poles, and an attribute-sanitising hole in popup and marker HTML (#943).
- MapLibre GL JS 5 replaced by 6. Version 6 ships as an ES module only, with no UMD bundle and no global of its own. The loader imports it with
importModuleand publishes the namespace asglobalThis.maplibregl, which every@JSbinding here addresses.MapLibreJsSource.urlsnow points at the.mjsbuild. An older non-module bundle still works: the loader keeps the global that build defines rather than publishing an empty namespace over it. A page usingMapLibreJsSource.preloadedhas to publish the global itself (#943). setGeoJsonSource()andsetFeatureForGeoJsonSource()complete once the data has been applied, rather than as soon as it has been handed over. Version 6 returns a promise fromGeoJSONSource.setDatawhere version 5 returned the source, so the promise is awaited when there is one. That also stops a rejection on invalid GeoJSON from going unhandled (#943).- Missing style images are supplied through
Map.setMissingStyleImageResolverinstead of astyleimagemissinglistener. Since version 6 the listener can observe the request, but callingaddImagefrom it no longer resolves it, which would have silently stopped asset images from loading. The listener is kept as a fallback when the library on the page has no resolver, so a page still providing version 5 keeps working (#943). - A map that comes up without a renderer now reports why through
FlutterError.reportError, once per distinct cause. Version 6 requires WebGL2 and dropped the WebGL1 fallback. Rather than throwing like version 5, it fires anerrorfrom inside the constructor, too early to subscribe to, so the map would otherwise just be blank. The message tells a WebGL1 only browser apart from one with no WebGL at all, and names the version 5 build as the fix for the former (#943).
0.26.2 #
No web-specific changes; version aligned with the maplibre_gl 0.26.2 release. See the top-level CHANGELOG for full details.
0.26.1 #
No web-specific changes; version aligned with the maplibre_gl 0.26.1 release. See the top-level CHANGELOG for full details.
0.26.0 #
Breaking #
- Upgraded MapLibre GL JS from 4.7.1 to 5.24.0 (#761, #651).
initialCameraPositionis now ignored if the map style contains camera properties (center,zoom,bearing,pitch). MapLibre GL JS v5 gives priority to style-defined camera values over constructor options. UseMapLibreMapController.moveCamera()orMapLibreMapController.animateCamera()after map load to override.preserveDrawingBuffer,antialias,failIfMajorPerformanceCaveatnow set viacanvasContextAttributes(MapLibre GL JS v5 API change).on()/off()/once()adapted for v5Subscriptionreturn type.- Removed
customAttributionfromMapOptionsJsImpl(moved toAttributionControloptions in v5).
Added #
- Exposed
onMouseMoveand added feature state management (setFeatureState,getFeatureState,removeFeatureState) (#718). - Added
getLayerVisibility, web snapshot, and map sizing features (#722). - Added Scale Control (#720).
- Location engine properties support —
enableHighAccuracy,maximumAge,timeoutfromLocationEnginePlatforms.web()passed toGeolocateControl'sPositionOptions. trackUserLocationonGeolocateControlmanaged based onMyLocationTrackingMode.GeolocateControl.trigger()called programmatically when tracking mode is enabled.easeCamerafully implemented via MapLibre GL JSmap.easeTo({easing}); all fourCameraAnimationInterpolationvalues are honored via cubic-bezier easing callbacks. Previously threwUnimplementedError(#789).easeInOut→ cubic-bezier(0.42, 0, 0.58, 1)easeOut→ cubic-bezier(0, 0, 0.58, 1)fastOutLinearIn→ cubic-bezier(0.4, 0, 1, 1)(Material Design)linear→ identity- Omitting the parameter falls through to MapLibre GL JS's built-in default curve.
Changed #
easeTowrapper onMapLibreMapnow jsifies DartMapoptions the same wayflyToalready did, enabling the neweaseCameraimplementation to pass a plain Dart options dict.
Fixed #
- Improved
styleimagemissinghandling (#725). - Fixed JS Interop and WASM compilation in release mode (#714).
removeLayerandremoveSourceno longer throw when the layer/source doesn't exist.setGeoJsonSourcereturns early instead of crashing when the source doesn't exist.
0.25.0 - 2026-01-07 #
Major Changes #
BREAKING: Migration to Modern JS Interop (#687)
- WASM Compatible: Migrated from deprecated
dart:js_utilto moderndart:js_interopAPI - Required for Flutter 3.38.4+ compatibility
- Now fully compatible with Flutter's WASM compilation target
- No public API changes - this is an internal implementation update
Technical Details of JS Interop Migration:
- Replaced
dart:js_utilwithdart:js_interopanddart:js_interop_unsafe - Updated all JS interop classes to use
@staticInterop+ extension methods pattern - Migrated from
@JS()factory constructors to new interop model - Converted
allowInterop()callbacks to.toJS - Updated property access from
getProperty()/setProperty()to native JS property access - Replaced
jsify()/dartify()utilities to work withJSAny/JSObjecttypes - Fixed primitive type conversions:
JSString.toDart,JSNumber.toDartDouble,JSArray.toDart - Converted static methods to top-level functions (e.g.,
LngLat.convert()→lngLatConvert())
Added #
- Implemented
getStyle()- returns map style as JSON string (previously threwUnimplementedError) - Implemented
getSourceIds()- returns list of source IDs from current style - Improved
getLayers()- safely handles null styles and returns empty list instead of crashing
Fixed #
- Fixed
setPaintPropertyandsetLayoutPropertyto handle nullableJSAnyvalues correctly (#12dfad2) - Improved
jsifyfunction to create JS arrays correctly - Enhanced error handling in
getLayer(),getFilter(), andisStyleLoaded()with null-safety checks - Fixed pattern images loading - all images now correctly converted to RGBA format (#9ce52a6)
- Resolves mismatched image size errors when loading pattern images
- Ensures consistent image format across all image uploads
Refactor #
- Improved null safety across the web platform
- Enhanced type safety for JS ↔ Dart conversions
- More descriptive error messages in the web implementation
- Example app improvements:
- Maps now use responsive sizing (50-60% of screen height)
- Removed fixed width constraints for full-screen responsiveness
- Better button and control layouts
0.24.1 #
- Rollback maplibre-gl to
4.7.1version. (#660)
0.24.0 #
Refactor / Quality (web) #
- Refactored
onMapClick(degenerate bbox + interactive layer filter) so unmanaged style-layer features now triggeronFeatureTapped(feature id + layer id,annotation = null). - Ensured map container stretches vertically by setting
style.height = '100%'on the registered div to avoid zero-height issues in flexible layouts.
0.23.0 #
Note: This release has breaking changes.
see top-level CHANGELOG.md
newer releases #
see top-level CHANGELOG.md
0.15.1, May 24, 2022 #
see top-level CHANGELOG.md
0.15.0, Oct 26, 2021 #
see top-level CHANGELOG.md
0.14.0, Oct 14, 2021 #
0.13.0, Oct 6, 2021 #
🎉 The first release of flutter-maplibre-gl with the complete transition to MapLibre libraries. 🎉
Changes cherry-picked/ported from tobrun/flutter-mapbox-gl:0.12.0 #
- Dependencies: updated image package #598
- Fix feature manager on release build #593
- Emit onTap only for the feature above the others #589
- Add annotationOrder to web #588
Changes cherry-picked/ported from tobrun/flutter-mapbox-gl:0.11.0 #
Below is the original changelog of the tobrun/flutter-mapbox-gl project, before the fork. #
0.10.0, February 12, 2020 #
- Added web support for fills #501
- Add heading to UserLocation and expose UserLocation type #522
- Update tracked camera position in camera#onIdle #500
- Improved Image Source Support #469
0.9.0, October 24. 2020 #
- Breaking change: CameraUpdate.newLatLngBounds() now supports setting different padding values for left, top, right, bottom with default of 0 for all. Implementations using the old approach with only one padding value for all edges have to be updated. #382
- web:ignore myLocationTrackingMode if myLocationEnabled is false #363
- Add methods to access projection #380
- Listen to OnUserLocationUpdated to provide user location to app #237
- Get meters per pixel at latitude #416
0.8.0, August 22, 2020 #
0.7.0 #
- Initial version