40 lines
738 B
Dart
40 lines
738 B
Dart
class UnitOfMeasure {
|
|
final int? id;
|
|
final String name;
|
|
final String? abbreviation;
|
|
|
|
UnitOfMeasure({
|
|
this.id,
|
|
required this.name,
|
|
this.abbreviation,
|
|
});
|
|
|
|
factory UnitOfMeasure.fromJson(Map<String, dynamic> json) {
|
|
return UnitOfMeasure(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
abbreviation: json['abbreviation'],
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'name': name,
|
|
'abbreviation': abbreviation,
|
|
};
|
|
}
|
|
|
|
UnitOfMeasure copyWith({
|
|
int? id,
|
|
String? name,
|
|
String? abbreviation,
|
|
}) {
|
|
return UnitOfMeasure(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
abbreviation: abbreviation ?? this.abbreviation,
|
|
);
|
|
}
|
|
}
|