Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(battery_plus): Implement not charging battery state #2275

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading