PolygonGeofence class

A geofence defined by a polygon (list of vertices).

Polygon geofences allow defining irregular shapes for geofencing, such as building outlines, parking lots, or delivery zones.

The polygon must have at least 3 vertices to form a valid shape. Vertices should be defined in order (clockwise or counter-clockwise). The polygon is automatically closed (last vertex connects to first).

Constructors

PolygonGeofence({required String identifier, required List<GeoPoint> vertices, bool notifyOnEntry = true, bool notifyOnExit = true, bool notifyOnDwell = false, int? loiteringDelay, JsonMap? extras})
const
PolygonGeofence.fromMap(JsonMap map)
factory

Properties

areaSquareMeters double
Calculates the approximate area of the polygon in square meters.
no setter
boundingBox List<double>
Returns the bounding box of the polygon as minLat, minLng, maxLat, maxLng.
no setter
centroid GeoPoint
Returns the centroid (geometric center) of the polygon.
no setter
extras JsonMap?
Additional metadata for this geofence.
final
hashCode int
The hash code for this object.
no setteroverride
identifier String
Unique identifier for this geofence.
final
isValid bool
Returns true if this polygon geofence has valid configuration.
no setter
loiteringDelay int?
Minimum time (ms) to trigger dwell event.
final
notifyOnDwell bool
Whether to trigger on dwell events (staying inside).
final
notifyOnEntry bool
Whether to trigger on entry events.
final
notifyOnExit bool
Whether to trigger on exit events.
final
perimeterMeters double
Returns the approximate perimeter of the polygon in meters.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
vertices List<GeoPoint>
List of vertices defining the polygon boundary. Must have at least 3 points.
final

Methods

containsGeoPoint(GeoPoint point) bool
Returns true if the given GeoPoint is inside this polygon.
containsPoint(double latitude, double longitude) bool
Returns true if the given point is inside this polygon.
copyWith({String? identifier, List<GeoPoint>? vertices, bool? notifyOnEntry, bool? notifyOnExit, bool? notifyOnDwell, int? loiteringDelay, JsonMap? extras}) PolygonGeofence
Creates a copy with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() JsonMap
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override