Skip to content

2.3.0

Compare
Choose a tag to compare
@evil159 evil159 released this 02 Oct 07:47
· 45 commits to main since this release
0a5b625

Features ✨ and improvements 🏁

  • Deprecate untyped default constructor of RenderedQueryGeometry with typed constructors: RenderedQueryGeometry.fromList()/fromScreenBox()/fromScreenCoordinate().

This change improves type safety and clarity in the code. By using specific constructors, you can ensure that the RenderedQueryGeometry is created with the correct type of data, reducing the risk of runtime errors and making the code easier to understand and maintain.

Example:

Before:

// Using the untyped default constructor
final geometry = RenderedQueryGeometry(type: Type.SCREEN_COORDINATE, value jsonEncode(screenCoordinate.encode()));

After:

// Using a typed constructor
final geometry = RenderedQueryGeometry.fromScreenCoordinate(screenCoordinate);
  • Expose API to clear map data, and to set options to TileStore.

You can now clear temporary map data from the data path defined in the given resource options, which is useful when you want reduce the disk usage or in case the disk cache contains invalid data.

await MapboxMapsOptions.clearData();

And you can now set additional options to a TileStore, for example, a maximum amount of bytes TileStore can use to store files., base URL to use for requests to the Mapbox API, or URL template for making tile requests.

// Set the disk quota to zero, so that tile regions are fully evicted
// when removed.
// This removes the tiles from the predictive cache.
tileStore.setDiskQuota(0);
  • Add support for partial GeoJSON updates.

Instead of setting a whole new GeoJSON object anew every time a single feature has changed, now you can apply more granular, partial GeoJSON updates.
If your features have associated identifiers - you can add, update, and remove them on individual basis in your GeoJSONSource. This is especially beneficial for GeoJSONSources hosting a large amount of features - in this case adding a feature can be up to 4x faster with the partial GeoJSON update API.

mapboxMap.style.addGeoJSONSourceFeatures(sourceId, dataId, features)
mapboxMap.style.updateGeoJSONSourceFeatures(sourceId, dataId, features)
mapboxMap.style.removeGeoJSONSourceFeatures(sourceId, dataId, featureIds)
  • Expose data-driven properties on annotation managers. Now it's possible to set data-driven properties globally on annotation manager and specify per-annotation overrides.
    Previously user had to specify those properties on each annotation and couldn't specify them globally.

In this case each even annotation will have random color, but others will use the global default specified in the annotation manager.

final circleAnnotationManager = await mapboxMap.annotations.createCircleAnnotationManager();
var annotations = <CircleAnnotationOptions>[];
for (var i = 0; i < 2000; i++){
  var annotation = CircleAnnotationOptions(
    geometry: createRandomPoint(),
    circleColor: (i % 2 == 0) ? createRandomColor() : null,
    );

  annotations.add(annotation);
}
circleAnnotationManager.setCircleColor(Colors.blue.value);
  • Expose autoMaxZoom property for GeoJsonSource to fix rendering issues with FillExtrusionLayer in some cases.
  • Expose experimental ClipLayer to remove 3D data (fill extrusions, landmarks, trees) and symbols.
  • Deprecate SlotLayer.sourceId and SlotLayer.sourceLayer as they have no effect in this layer.
  • Expose experimental SymbolLayer.symbolElevationReference and SymbolLayer.symbolZOffset.
  • Add missing @experimental annotations to Layer's Expression properties.
  • Remove experimental modelFrontCutoff property from ModelLayer.
  • Expose experimental lineTrimColor and lineTrimFadeRange on LineLayer which allow to set custom color for trimmed line and fade effect for trim.
  • Add experimental FillExtrusionLayer.fillExtrusionLineWidth that can switch fill extrusion rendering into wall rendering mode. Use this property to render the feature with the given width over the outlines of the geometry.
  • Add experimental MapboxMap.setSnapshotLegacyMode() to help avoiding MapboxMap.snapshot() native crash on some Samsung devices running Android 14. MapboxMap.setSnapshotLegacyMode() has no effect on iOS.
  • Add GestureState to MapContentGestureContext to indicate whether gesture has been started, its touches have changed or it has ended.

Bug fixes 🐞

  • Fix StyleManager.getLayer() failing for ModelLayer, RasterParticleLayer and SlotLayer.
  • Fix build errors when using Flutter SDK 3.24.

Dependency Updates

  • Update Mapbox Maps SDK to 11.7.0
    • For platform-specific updates see: iOS & Android