PrivacyZone class

Defines a circular privacy zone where location data is protected.

Privacy zones allow apps to define areas where location data should be obfuscated or excluded entirely, supporting privacy compliance requirements.

Example:

final homeZone = PrivacyZone(
  identifier: 'home',
  latitude: 37.7749,
  longitude: -122.4194,
  radius: 100.0,
  action: PrivacyZoneAction.obfuscate,
  obfuscationRadius: 500.0,
);

Constructors

PrivacyZone({required String identifier, required double latitude, required double longitude, required double radius, PrivacyZoneAction action = PrivacyZoneAction.obfuscate, double obfuscationRadius = 500.0, String? label, bool enabled = true, JsonMap? extras, required DateTime createdAt, DateTime? updatedAt})
const
PrivacyZone.create({required String identifier, required double latitude, required double longitude, required double radius, PrivacyZoneAction action = PrivacyZoneAction.obfuscate, double obfuscationRadius = 500.0, String? label, bool enabled = true, JsonMap? extras})
Creates a privacy zone with current timestamp.
factory
PrivacyZone.fromMap(JsonMap map)
factory

Properties

action PrivacyZoneAction
Action to take when location is within this zone.
final
createdAt DateTime
When this zone was created.
final
enabled bool
Whether this zone is currently active.
final
extras JsonMap?
Optional metadata for this zone.
final
hashCode int
The hash code for this object.
no setteroverride
identifier String
Unique identifier for this privacy zone.
final
isValid bool
Whether this zone configuration is valid.
no setter
label String?
Optional label for display purposes.
final
latitude double
Center latitude of the zone.
final
longitude double
Center longitude of the zone.
final
obfuscationRadius double
For obfuscate action: radius within which to randomly offset coordinates. Defaults to 500 meters if not specified.
final
radius double
Radius in meters defining the zone boundary.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
updatedAt DateTime?
When this zone was last updated.
final

Methods

containsLocation(double lat, double lng) bool
Checks if a location point is within this privacy zone.
containsLocationObject(Location location) bool
Checks if a Location is within this privacy zone.
copyWith({String? identifier, double? latitude, double? longitude, double? radius, PrivacyZoneAction? action, double? obfuscationRadius, String? label, bool? enabled, JsonMap? extras, DateTime? createdAt, DateTime? updatedAt}) PrivacyZone
Creates a copy with modified values.
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