addCustomMarker method

  1. @override
dynamic addCustomMarker({
  1. required LatLng point,
  2. required String title,
  3. MapMarkerIconModel? icon,
  4. required List<MapButtonClass> buttons,
  5. List<String>? images,
  6. List<MapMarkerContentModel>? content,
})
override

Create marker on point with title, in this marker you may configure a button and its callback on point with title buttons with names and callbacks acts

Implementation

@override
addCustomMarker(
    {required LatLng point,
    required String title,
      MapMarkerIconModel? icon,
    required List<MapButtonClass> buttons,
    List<String>? images,
    List<MapMarkerContentModel>? content}) {
  List<String> buttIds = [];

  for (int index = 0; index < buttons.length; index++) {
    String id = createUniqueUid(count: 6, isNumberEnabled: false);
    buttIds.add(id);

    buttons[index] = buttons[index]..id = id;

    //print(id);
    super.markersAction[id] = buttons[index].act;
  }

  js_util.globalContext.callMethodVarArgs('_addMarkerCustom'.toJS, [
    point.latitude.toJS,
    point.longitude.toJS,
    title.toJS,
    icon != null ? icon.toMapJs().toJS : "none".toJS,
    [...buttons.map((e) => e.toMapJs().toJS)].toJS,
    images != null ? [...images.map((e) => e.toJS)].toJS : null,
    content != null ? [...content.map((e) => e.toMapJs().toJS)].toJS : null,
  ]);
}