NeshanMap constructor
- Key? key,
- required String mapKey,
- NeshanMapConfig? config,
- List<
NeshanMarker> markers = const [], - List<
NeshanPolygon> polygons = const [], - List<
NeshanPolyline> polylines = const [], - List<
NeshanCircle> circles = const [], - NeshanMapController? controller,
- void onLocationChanged()?,
- void onMarkerTapped(
- String markerId
- void onPolygonTapped(
- String polygonId
- void onPolylineTapped(
- String polylineId
- void onCircleTapped(
- String circleId
- NeshanErrorCallback? onError,
- NeshanErrorCallback? onLocationError,
- 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,
});