NeshanMap constructor

const NeshanMap({
  1. Key? key,
  2. required String mapKey,
  3. NeshanMapConfig? config,
  4. List<NeshanMarker> markers = const [],
  5. List<NeshanPolygon> polygons = const [],
  6. List<NeshanPolyline> polylines = const [],
  7. List<NeshanCircle> circles = const [],
  8. NeshanMapController? controller,
  9. void onLocationChanged(
    1. double lat,
    2. double lng
    )?,
  10. void onMarkerTapped(
    1. String markerId
    )?,
  11. void onPolygonTapped(
    1. String polygonId
    )?,
  12. void onPolylineTapped(
    1. String polylineId
    )?,
  13. void onCircleTapped(
    1. String circleId
    )?,
  14. NeshanErrorCallback? onError,
  15. NeshanErrorCallback? onLocationError,
  16. bool enableDebug = false,
})

Creates a Neshan map widget.

mapKey — The Neshan API key. Required.

config — Viewport and style settings. Uses sensible defaults (Tehran centre, zoom 12, vector map) when omitted.

markers — Initial list of NeshanMarkers placed on the map when it first loads. To mutate markers at runtime use controller.

polygons — Initial list of NeshanPolygons placed on the map when it first loads. To mutate polygons at runtime use controller.

polylines — Initial list of NeshanPolylines placed on the map when it first loads. To mutate polylines at runtime use controller.

circles — Initial list of NeshanCircles placed on the map when it first loads. To mutate circles at runtime use controller.

controller — Optional NeshanMapController for programmatic control (move, zoom, add/remove markers, etc.).

onLocationChanged — Fired whenever the map centre changes.

onMarkerTapped — Fired when a marker is tapped; receives the marker ID.

onPolygonTapped — Fired when a polygon is tapped; receives the polygon ID.

onPolylineTapped — Fired when a polyline is tapped; receives the polyline ID.

onCircleTapped — Fired when a circle is tapped; receives the circle ID.

onError — Fired on WebView / iframe / parsing errors.

onLocationError — Fired when location permission is denied or the location service is disabled.

enableDebug — Enables verbose console logging. Defaults to false.

Implementation

const NeshanMap({
  super.key,
  required this.mapKey,
  this.config,
  this.markers = const [],
  this.polygons = const [],
  this.polylines = const [],
  this.circles = const [],
  this.controller,
  this.onLocationChanged,
  this.onMarkerTapped,
  this.onPolygonTapped,
  this.onPolylineTapped,
  this.onCircleTapped,
  this.onError,
  this.onLocationError,
  this.enableDebug = false,
});