NeshanMap constructor

const NeshanMap({
  1. Key? key,
  2. required String mapKey,
  3. NeshanMapConfig? config,
  4. List<NeshanMarker> markers = const [],
  5. NeshanMapController? controller,
  6. void onLocationChanged(
    1. double lat,
    2. double lng
    )?,
  7. void onMarkerTapped(
    1. String markerId
    )?,
  8. NeshanErrorCallback? onError,
  9. NeshanErrorCallback? onLocationError,
  10. 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.

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.

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.controller,
  this.onLocationChanged,
  this.onMarkerTapped,
  this.onError,
  this.onLocationError,
  this.enableDebug = false,
});