set method

Future<void> set(
  1. T anntotation
)

Set an existing anntotation to the map. Use this to do a fast update for a single annotation

Implementation

Future<void> set(T anntotation) async {
  assert(_idToAnnotation.containsKey(anntotation.id),
      "you can only set existing annotations");
  _idToAnnotation[anntotation.id] = anntotation;
  final oldLayerIndex = _idToLayerIndex[anntotation.id];
  final layerIndex = selectLayer != null ? selectLayer!(anntotation) : 0;
  if (oldLayerIndex != layerIndex) {
    // if the annotation has to be moved to another layer/source we have to
    // set all
    await _setAll();
  } else {
    await controller.setGeoJsonFeature(
        _makeLayerId(layerIndex), anntotation.toGeoJson());
  }
}