Files
fcs/lib/domain/entities/carton_size.dart

43 lines
946 B
Dart
Raw Permalink Normal View History

2020-12-01 19:02:21 +06:30
class CartonSize {
2021-09-10 14:27:38 +06:30
String? id;
String? name;
2020-12-01 19:02:21 +06:30
double length;
double width;
double height;
2021-09-10 14:27:38 +06:30
CartonSize(
{this.id, this.name, this.length = 0, this.width = 0, this.height = 0});
2020-12-03 17:21:59 +06:30
Map<String, dynamic> toMap() {
return {
'id': id,
'name': name,
'length': length,
'width': width,
'height': height,
};
}
factory CartonSize.fromMap(Map<String, dynamic> map, String id) {
return CartonSize(
id: id,
name: map['name'],
length: map['length'],
width: map['width'],
height: map['height'],
);
}
2021-01-08 17:13:51 +06:30
@override
2021-09-10 14:27:38 +06:30
bool operator ==(Object other) => other is CartonSize && other.id == id;
2021-01-08 17:13:51 +06:30
@override
2021-09-10 14:27:38 +06:30
int get hashCode => id.hashCode;
2021-01-08 17:13:51 +06:30
bool isChangedForEdit(CartonSize cartonSize) {
return cartonSize.name != this.name ||
cartonSize.length != this.length ||
cartonSize.width != this.width ||
cartonSize.height != this.height;
}
2020-12-01 19:02:21 +06:30
}