BatteryPlatform class abstract

The interface that implementations of Battery must implement.

Platform implementations should extend this class rather than implement it as Battery does not consider newly added methods to be breaking changes. Extending this class (using extends) ensures that the subclass will get the default implementation, while platform implementations that implements this interface will be broken by newly added BatteryPlatform methods.

Inheritance
  • Object
  • PlatformInterface
  • BatteryPlatform
Implementers

Constructors

BatteryPlatform()
Constructs a BatteryPlatform.

Properties

batteryLevel Future<int>
Returns the current battery level in percent.
no setter
batteryState Future<BatteryState>
Returns the current battery state in percent.
no setter
hashCode int
The hash code for this object.
no setterinherited
isInBatterySaveMode Future<bool>
Returns true if the device is on battery save mode
no setter
onBatteryStateChanged Stream<BatteryState>
Returns a Stream of BatteryState changes.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance BatteryPlatform
The default instance of BatteryPlatform to use.
getter/setter pair