Battery.fromMap constructor
fromMap is the method to convert the map to the class.
Implementation
factory Battery.fromMap(Map<String, dynamic> map) {
return Battery(
level: map['level']?.toInt(),
health: map['health'],
status: map['status'],
powerSource: map['powerSource'],
technology: map['technology'],
temperature: map['temperature'],
voltage: map['voltage'],
powerProfile: map['powerProfile'],
);
}