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

51 lines
1.0 KiB
Dart
Raw Normal View History

2020-12-01 19:02:21 +06:30
class CartonSize {
String id;
String name;
double length;
double width;
double height;
CartonSize({this.id, this.name, this.length, this.width, this.height});
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
bool operator ==(other) {
if (identical(this, other)) {
return true;
}
return other.id == this.id;
}
@override
int get hashCode {
int result = 17;
result = 37 * result + id.hashCode;
return result;
}
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
}