addPoi method
Future<String>
addPoi(
- LatLng position, {
- required PoiStyle style,
- String? id,
- String? text,
- int? rank,
- bool visible = true,
override
Implementation
@override
Future<String> addPoi(
LatLng position, {
required PoiStyle style,
String? id,
String? text,
int? rank,
bool visible = true,
}) async {
final poiId = manager._uuid.v4();
_preEncodedImage[poiId] = {};
if (style.icon != null) {
_preEncodedImage[poiId]![style.zoomLevel] =
encodeImageToBase64(await style.icon!.readBytes());
}
for (var inStyle in style.otherStyles) {
if (inStyle.icon == null) continue;
_preEncodedImage[poiId]![inStyle.zoomLevel] =
encodeImageToBase64(await style.icon!.readBytes());
}
final encodedIcon = _preEncodedImage[poiId]?[style.zoomLevel];
final options = WebCustomOverlayOption(
clickable: true,
content: poiElement(poiId, encodedIcon, style.icon, text, style, () {
manager._onPoiClick(this.id, poiId, isLod);
}),
position: WebLatLng.fromLatLng(position),
xAnchor: style.anchor.x.toDouble(),
yAnchor: style.anchor.y.toDouble(),
zIndex: rank ?? 10001);
_currentPoiLevel[poiId] = style.zoomLevel;
final overlay = _webPoi[poiId] = WebCustomOverlay(options);
overlay.setMap(controller);
overlay.setVisible(visible);
_poiStyleId[poiId] = style.id!;
_syncZoomLevel(poiId, style.id!, text);
return poiId;
}