from static method

BatteryStatus? from(
  1. double level
)

Implementation

static BatteryStatus? from(double level) {
  if (level == -1) return null;
  return BatteryStatus.values.singleWhere((e) => level > e.minLevel && level < e.maxLevel);
}