AppleWatchBattery
Battery data from the Apple Watch.
- Inheritance
-
- Object
- Serializable
- Data
- AppleWatchData
- AppleWatchBattery
- Annotations
-
- @JsonSerializable(fieldRename: FieldRename.none, includeIfNull: false)
Constructors
AppleWatchBattery.fromJson
AppleWatchBattery.fromRecord
Create an AppleWatchBattery from an AWARE ios_watch_battery record.
Note that AWARE stores the battery level as a fraction (0.0-1.0), which is converted to percent (0-100) here.
AppleWatchBattery
- String? deviceId,
- DateTime? timestamp,
- String? label,
- int batteryLevel = -1,
- WatchBatteryState batteryState = WatchBatteryState.unknown,
Properties
batteryLevel
The battery level of the watch in percent (0-100).
Note that watchOS reports the battery level in steps of 5%. Is -1 if the level is unknown, e.g., when battery monitoring is disabled.
batteryState
The charging state of the watch battery.
fromJsonFunction
The function which can convert a JSON string to an object of this type.
jsonType
Return the __type to be used for JSON serialization of this class. Default is runtimeType. Only specify this if you need another type.
Methods
toJson
Return a JSON encoding of this object.
toString
A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.