AdaptiveTrackingConfig class

Configuration for adaptive tracking behavior.

Adaptive tracking dynamically adjusts location settings based on current conditions to optimize battery life while maintaining the required accuracy for your use case.

Example:

final config = Config(
  adaptiveTracking: AdaptiveTrackingConfig(
    enabled: true,
    speedTiers: SpeedTiers.driving,
    batteryThresholds: BatteryThresholds.conservative,
    activityOptimization: true,
  ),
);

Constructors

AdaptiveTrackingConfig({bool enabled = true, SpeedTiers speedTiers = const SpeedTiers(), BatteryThresholds batteryThresholds = const BatteryThresholds(), bool activityOptimization = true, bool stationaryGpsOff = true, Duration stationaryDelay = const Duration(minutes: 1), double minAccuracyMeters = 100, bool filterDuplicates = true, double duplicateDistanceMeters = 5, bool geofenceOptimization = true, bool smartHeartbeat = true, Duration maxHeartbeatInterval = const Duration(minutes: 15), Duration minHeartbeatInterval = const Duration(minutes: 1)})
Creates an adaptive tracking configuration.
const
AdaptiveTrackingConfig.fromMap(JsonMap map)
Creates from a map.
factory

Properties

activityOptimization bool
Whether to optimize based on activity recognition.
final
batteryThresholds BatteryThresholds
Battery level thresholds for optimization.
final
duplicateDistanceMeters double
Distance threshold for duplicate detection.
final
enabled bool
Whether adaptive tracking is enabled.
final
filterDuplicates bool
Whether to skip duplicate locations.
final
geofenceOptimization bool
Whether to downgrade accuracy when in a geofence.
final
hashCode int
The hash code for this object.
no setterinherited
maxHeartbeatInterval Duration
Maximum heartbeat interval when stationary.
final
minAccuracyMeters double
Minimum accuracy to accept when in power-saving mode.
final
minHeartbeatInterval Duration
Minimum heartbeat interval when moving.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
smartHeartbeat bool
Whether to enable smart heartbeat (extend interval when stationary).
final
speedTiers SpeedTiers
Speed-based update interval tiers.
final
stationaryDelay Duration
Time to wait before disabling GPS after becoming stationary.
final
stationaryGpsOff bool
Whether to disable GPS when stationary for extended periods.
final

Methods

calculateSettings({required double speedMps, required int batteryPercent, required bool isCharging, required bool isMoving, required ActivityType? activity, required bool isInGeofence, Duration? timeSinceStationary}) AdaptiveSettings
Calculates optimal settings based on current conditions.
copyWith({bool? enabled, SpeedTiers? speedTiers, BatteryThresholds? batteryThresholds, bool? activityOptimization, bool? stationaryGpsOff, Duration? stationaryDelay, double? minAccuracyMeters, bool? filterDuplicates, double? duplicateDistanceMeters, bool? geofenceOptimization, bool? smartHeartbeat, Duration? maxHeartbeatInterval, Duration? minHeartbeatInterval}) AdaptiveTrackingConfig
Creates a copy with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() JsonMap
Converts to a JSON-serializable map.
toString() String
A string representation of this object.
inherited

Operators

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

Constants

aggressive → const AdaptiveTrackingConfig
Aggressive preset - maximum battery savings.
balanced → const AdaptiveTrackingConfig
Balanced preset - moderate optimization.
disabled → const AdaptiveTrackingConfig
Disabled - no adaptive optimization.