BatteryState.fromMap constructor

BatteryState.fromMap(
  1. Map<String, dynamic> map
)

Creates a BatteryState from a map, typically received from platform code.

The map must contain 'level', 'temperature', and 'isCharging' keys.

Implementation

factory BatteryState.fromMap(Map<String, dynamic> map) {
  return BatteryState(
    level: map['level'],
    temperature: map['temperature'],
    isCharging: map['isCharging'],
  );
}