BatteryState class
Battery level and charging status of the phone.
Collected by BatteryProbe for the DeviceSamplingPackage.BATTERY_STATE
measure. batteryStatus holds one of the STATE_* constants.
- Inheritance
-
- Object
- Serializable
- Data
- BatteryState
- Annotations
-
- @JsonSerializable.new(includeIfNull: false, explicitToJson: true)
Constructors
- BatteryState([int? batteryLevel, String? batteryStatus])
- BatteryState.fromBatteryState(int level, BatteryState state)
-
Creates a BatteryState from a battery
leveland abattery_plusstate. -
BatteryState.fromJson(Map<
String, dynamic> json) -
factory
Properties
- $type ↔ String?
-
The type name written to
__typein JSON; set tojsonTypeon creation.getter/setter pairinherited - batteryLevel ↔ int?
-
The battery level in percent (0-100).
getter/setter pair
- batteryStatus ↔ String?
-
The charging status of the battery:
getter/setter pair
- dataType → DataType
-
The type of this data as a
DataType.no setterinherited - fromJsonFunction → Function
-
The generated function that converts a JSON map to an object of this type.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setteroverride
- jsonType → String
-
The
__typeused for JSON serialization of this class.no setterinherited - recordId → String?
-
Stable identifier of the source record, if available; null by default.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
equivalentTo(
Data other) → bool -
Returns
trueif the batteryLevel is equal.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Returns a JSON map of this object, including the
__typeproperty.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Constants
- STATE_CHARGING → const String
- STATE_CONNECTED_NOT_CHARGING → const String
- STATE_DISCHARGING → const String
- STATE_FULL → const String
- STATE_UNKNOWN → const String