Skip to content

Commit

Permalink
Implement not charging battery state
Browse files Browse the repository at this point in the history
  • Loading branch information
Cengiz Gümüs committed Oct 18, 2023
1 parent 2f76fce commit 855f239
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ class BatteryPlusPlugin : MethodCallHandler, EventChannel.StreamHandler, Flutter
return when (status) {
BatteryManager.BATTERY_STATUS_CHARGING -> "charging"
BatteryManager.BATTERY_STATUS_FULL -> "full"
BatteryManager.BATTERY_STATUS_DISCHARGING, BatteryManager.BATTERY_STATUS_NOT_CHARGING -> "discharging"
BatteryManager.BATTERY_STATUS_DISCHARGING -> "discharging"
BatteryManager.BATTERY_STATUS_NOT_CHARGING -> "not_charging"
BatteryManager.BATTERY_STATUS_UNKNOWN -> "unknown"
else -> null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ enum BatteryState {
/// The battery is currently losing energy.
discharging,

/// The battery is not charging.
notCharging,

/// The state of the battery is unknown.
unknown
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ BatteryState parseBatteryState(String state) {
return BatteryState.charging;
case 'discharging':
return BatteryState.discharging;
case 'not_charging':
return BatteryState.notCharging;
case 'unknown':
return BatteryState.unknown;
default:
Expand Down

0 comments on commit 855f239

Please sign in to comment.