addZone method
Adds the current zone to the list of zones if it meets the required coordinate count.
zone
is the zone to be added. If the zone has enough coordinates (based on minimumCoordinatesForAdding),
it is added to the zones
list and the camera is moved to the zone's coordinates.
Implementation
void addZone(Zone zone) {
if ((minimumCoordinatesForAdding ?? 0) < zone.coordinates.length) {
if (multiZone == false) {
zones.clear();
}
zones.add(zone);
_moveCameraToZone(zone.coordinates);
_currentZoneCoordinates = null;
notifyListeners();
if (onZoneAdded != null) {
onZoneAdded!(zone);
}
} else {
onError?.call(
"A zone must have at least $minimumCoordinatesForAdding coordinates. Please add more coordinates before proceeding.");
}
}