LowBatteryConfig class
Configuration for low battery optimization.
Defines thresholds and behavior when battery level is low.
Example:
final config = Config(
lowBattery: LowBatteryConfig(
threshold: 0.20, // 20%
throttleInterval: Duration(minutes: 10),
disableAutoSync: true,
),
);
Constructors
- LowBatteryConfig({double threshold = 0.15, Duration throttleInterval = const Duration(minutes: 5), bool disableAutoSync = false})
-
Creates a low battery configuration.
const
-
LowBatteryConfig.fromMap(Map<
String, dynamic> map) -
Creates from a map.
factory
Properties
- disableAutoSync → bool
-
Whether to disable automatic sync when battery is low.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- threshold → double
-
Battery level threshold (0.0 to 1.0) at which low battery mode activates.
final
- throttleInterval → Duration
-
Interval between location updates when in low battery mode.
final
Methods
-
copyWith(
{double? threshold, Duration? throttleInterval, bool? disableAutoSync}) → LowBatteryConfig - Creates a copy with the given fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> - Converts to a JSON-serializable map.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Constants
- aggressive → const LowBatteryConfig
- Aggressive battery saving at 20% threshold.
- conservative → const LowBatteryConfig
- Conservative - only activate at very low battery.
- defaultConfig → const LowBatteryConfig
- Default configuration with 15% threshold.