barely functional database with hive
This commit is contained in:
@@ -4,6 +4,18 @@ class Unit {
|
||||
final System system;
|
||||
|
||||
Unit(this.name, this.type, {this.system = System.metric});
|
||||
|
||||
factory Unit.fromJson(Map<String, dynamic> json) => Unit(
|
||||
json['name'] as String,
|
||||
json['type'] as UnitType,
|
||||
system: json['system'] as System,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'name': name,
|
||||
'type': type,
|
||||
'system': system,
|
||||
};
|
||||
}
|
||||
|
||||
enum System { metric, imperial, neutral }
|
||||
|
||||
Reference in New Issue
Block a user