Skip to content

Commit

Permalink
feat(battery_plus): Introduce not_charging state on Linux (#2400)
Browse files Browse the repository at this point in the history
  • Loading branch information
vbuberen committed Dec 1, 2023
1 parent 78f44bf commit 42ef02b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ extension _ToBatteryState on UPowerDeviceState {
switch (this) {
case UPowerDeviceState.charging:
return BatteryState.charging;

case UPowerDeviceState.discharging:
case UPowerDeviceState.pendingDischarge:
return BatteryState.discharging;

case UPowerDeviceState.fullyCharged:
return BatteryState.full;

case UPowerDeviceState.pendingCharge:
return BatteryState.connectedNotCharging;

default:
return BatteryState.unknown;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ enum BatteryState {
charging,

/// Device is connected to external power source, but not charging the battery.
///
/// Usually happens when device has charge limit enabled and this limit is reached.
/// Available on MacOS and Android platforms only.
/// Also, battery might be in this state if connected power source isn't powerful enough to charge the battery.
///
/// Available on Android, MacOS and Linux platforms only.
connectedNotCharging,

/// The battery is currently losing energy.
Expand Down

0 comments on commit 42ef02b

Please sign in to comment.