MapViewModel class
- Inheritance
-
- Object
- ChangeNotifier
- MapViewModel
Constructors
- MapViewModel({required String customMarkerPath, required String customMidMarkerPath, Color boundaryLineColor = Colors.green, Color fillColor = const Color.fromARGB(77, 0, 255, 0)})
- Creates a MapViewModel with optional custom boundary and fill colors.
Properties
- boundaryLineColor → Color
-
Color of the boundary lines.
final
- currentLocation → LatLng?
-
User's current location as a
LatLng, if available.no setter - customMarkerPath → String
-
Path to the custom icon asset used for main point markers.
final
- customMidMarkerPath → String
-
Path to the custom icon asset used for midpoint markers.
final
-
distanceMarkers
→ Set<
Marker> -
Set of distance markers showing distances between points.
no setter
- fillColor → Color
-
Fill color used when a polygon is completed.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasInteracted → bool
-
Returns true if the user has interacted with the map.
no setter
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
markers
→ Set<
Marker> -
Set of markers placed on the map.
no setter
-
midpointMarkers
→ Set<
Marker> -
Set of midpoint markers used for distance calculations.
no setter
-
polygons
→ Set<
Polygon> -
Set of polygons drawn on the map.
no setter
-
polylines
→ Set<
Polyline> -
Set of polylines drawn on the map.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- totalArea → double
-
Calculates the total area of the tapped points.
no setter
- totalPerimeter → double
-
Calculates the total perimeter of the tapped points.
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addPoint(
LatLng point) → void -
Adds a new
LatLngpoint to the map and updates all visual elements. -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
initialize(
) → Future< LocationPermissionStatus> - Initializes the map by requesting permissions, getting user location, and preloading custom marker assets.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
redoLastPoint(
) → void - Restores the last undone point and updates shapes.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resetBoundary(
) → void - Clears all points, markers, and shapes.
-
setMapController(
GoogleMapController controller) → void -
Sets the
GoogleMapControllerfor this view model. -
toString(
) → String -
A string representation of this object.
inherited
-
undoLastPoint(
) → void - Removes the last tapped point and updates shapes.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited