setIconMarker method

  1. @override
Future<void> setIconMarker(
  1. GeoPoint point,
  2. MarkerIcon markerIcon
)

setIconMarker this method change marker icon , marker should be already exist in the map or it will throw exception that marker not exist

point : (geoPoint) geoPoint that want to change Icon

markerIcon : (MarkerIcon) the new icon marker that will replace old icon

Implementation

@override
Future<void> setIconMarker(GeoPoint point, MarkerIcon markerIcon) async {
  osmWebFlutterState.widget.dynamicMarkerWidgetNotifier.value = markerIcon;
  await Future.delayed(duration, () async {
    final icon = await capturePng(osmWebFlutterState.dynamicMarkerKey!);
    final size = osmWebFlutterState.dynamicMarkerKey?.currentContext?.size;
    final iconSize = size.toSizeJS();
    final jsP = point.toGeoJS();
    debugPrint("setIconMarker");
    await interop
        .changeMarker(
          mapIdMixin.toJS,
          jsP,
          null,
          icon.convertToString().toJS,
          iconSize,
          null,
          null,
        )
        //.modifyMarker(mapIdMixin.toJS, jsP, icon.convertToString().toJS)
        .toDart;
  });
}