PowerState class
Native battery and power state reported by the device.
Constructors
- PowerState({required int batteryLevel, required bool isCharging, required String chargingSource, required String batteryHealth, required String batteryStatus, required double batteryTemperatureCelsius, required bool isPowerSaveMode, required bool isIgnoringBatteryOptimizations, String? batteryState, bool? isBatteryMonitoringEnabled, bool? isBatteryMonitoringAvailable, String? thermalState, bool isIosNative = false})
-
Creates a power state description.
const
-
PowerState.fromMap(Map<
Object?, Object?> map) -
Creates a PowerState from a map returned by the native platform.
factory
Properties
- batteryHealth → String
-
The readable battery health reported by Android.
final
- batteryLevel → int
-
The battery level percentage from 0 to 100, or 0 when unavailable.
final
- batteryState → String?
-
Platform battery state, such as unknown, unplugged, charging, or full.
final
- batteryStatus → String
-
The readable battery status reported by Android.
final
- batteryTemperatureCelsius → double
-
The battery temperature in degrees Celsius.
final
- chargingSource → String
-
The readable charging source, such as AC, USB, Wireless, or Not charging.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isBatteryMonitoringAvailable → bool?
-
Whether native battery monitoring currently has usable battery data.
final
- isBatteryMonitoringEnabled → bool?
-
Whether native battery monitoring is enabled for this reading.
final
- isCharging → bool
-
Whether Android reports that the battery is charging or full.
final
- isIgnoringBatteryOptimizations → bool
-
Whether this app is ignoring Android battery optimizations.
final
- isIosNative → bool
-
Whether this power state came from the iOS native implementation.
final
- isPowerSaveMode → bool
-
Whether Android power saver mode is currently enabled.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- thermalState → String?
-
Current thermal state, when safely available.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, Object> - Converts this power state to a map using the native field names.
-
toString(
) → String -
Returns a readable string containing all power fields.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited