maplibre / flutter-maplibre-gl

Customizable, performant and vendor-free vector and raster maps, flutter wrapper for maplibre-native and maplibre-gl-js (fork of flutter-mapbox-gl/maps)
https://pub.dev/packages/maplibre_gl
Other
226 stars 125 forks source link

[BUG] Removing source on web #525

Open R-3MY opened 3 days ago

R-3MY commented 3 days ago

Platforms

web

Version of flutter maplibre_gl

0.20.0

Bug Description

It seem to be impossible to delete a source on web.

Steps to Reproduce

  1. Create MapLibreMap
  2. Add source
  3. Delete source
  4. Add again source with same name

Expected Results

Source is deleted

Actual Results

Source isn't deleted

Code Sample

Future<void>? refreshClusteredPointSource(String sourceId, Object? data, bool delete) async {
    if (delete) {
      debugPrint("DELETING SOURCE");
      try {
        await mapController!.removeSource(sourceId);
      } catch (e) {
        debugPrint("error removing source : $e");
      }
      debugPrint("DELETING SOURCE END");
    }
    debugPrint("ADDING SOURCE");
    await mapController!.addSource(sourceId, GeojsonSourceProperties(data: data, cluster: true, clusterMaxZoom: 12, clusterRadius: 50));
    debugPrint("ADDING SOURCE END");
  }

Console

DELETING SOURCE
null
DELETING SOURCE END
ADDING SOURCE
Error: Source "markers_source" already exists.