PrivacyZoneService class
Service for managing privacy zones and applying location obfuscation.
Privacy zones allow apps to define areas where location data should be protected. This supports GDPR and other privacy compliance requirements.
Example:
final service = PrivacyZoneService();
// Add a privacy zone around home
await service.addZone(PrivacyZone.create(
identifier: 'home',
latitude: 37.7749,
longitude: -122.4194,
radius: 100.0,
action: PrivacyZoneAction.obfuscate,
));
// Process location through privacy filter
final result = service.processLocation(myLocation);
if (result.isUsable) {
// Use result.processedLocation
}
Constructors
-
PrivacyZoneService({Future<
void> onPersist(List<PrivacyZone> )?, int? seed}) - Creates a new PrivacyZoneService.
Properties
-
enabledZones
→ List<
PrivacyZone> -
All enabled privacy zones.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
zoneChanges
→ Stream<
PrivacyZoneEvent> -
Stream of privacy zone change events.
no setter
- zoneCount → int
-
Number of registered zones.
no setter
-
zones
→ List<
PrivacyZone> -
All registered privacy zones.
no setter
Methods
-
addZone(
PrivacyZone zone) → Future< void> - Adds a privacy zone.
-
addZones(
List< PrivacyZone> zones) → Future<void> - Adds multiple privacy zones.
-
dispose(
) → void - Disposes of resources.
-
getMatchingZones(
Location location) → List< PrivacyZone> - Gets all zones that contain the given location.
-
getZone(
String identifier) → PrivacyZone? - Gets a zone by identifier.
-
hasZone(
String identifier) → bool - Checks if a zone exists.
-
isLocationAffected(
Location location) → bool - Checks if a location would be affected by any privacy zone.
-
loadZones(
List< PrivacyZone> zones) → Future<void> - Loads zones from storage.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
processLocation(
Location location) → PrivacyZoneResult - Processes a location through privacy zone rules.
-
processLocations(
List< Location> locations) → List<Location> - Processes multiple locations through privacy zone rules.
-
removeAllZones(
) → Future< void> - Removes all privacy zones.
-
removeZone(
String identifier) → Future< bool> - Removes a privacy zone by identifier.
-
setZoneEnabled(
String identifier, bool enabled) → Future< bool> - Enables or disables a zone.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateZone(
PrivacyZone zone) → Future< bool> - Updates a privacy zone.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited