updateTileOverlays method

  1. @override
Future<void> updateTileOverlays({
  1. required Set<TileOverlay> newTileOverlays,
  2. required int mapId,
})
override

Updates tile overlay configuration.

Change listeners are notified once the update has been made on the platform side.

The returned Future completes after listeners have been notified.

Implementation

@override
Future<void> updateTileOverlays({
  required Set<TileOverlay> newTileOverlays,
  required int mapId,
}) {
  final Map<TileOverlayId, TileOverlay>? currentTileOverlays =
      _tileOverlays[mapId];
  final Set<TileOverlay> previousSet = currentTileOverlays != null
      ? currentTileOverlays.values.toSet()
      : <TileOverlay>{};
  final TileOverlayUpdates updates =
      TileOverlayUpdates.from(previousSet, newTileOverlays);
  _tileOverlays[mapId] = keyTileOverlayId(newTileOverlays);
  return channel(mapId).invokeMethod<void>(
    'tileOverlays#update',
    updates.toJson(),
  );
}