fromPercent static method

GamepadBatteryLevel fromPercent(
  1. int percentage
)

Returns a battery level from a percentage.

Implementation

static GamepadBatteryLevel fromPercent(int percentage) => switch (percentage) {
  < 33 => low,
  < 66 => medium,
  <= 100 => full,
  _ => unknown,
};