class CartonSize { String id; String name; double length; double width; double height; CartonSize({this.id, this.name, this.length, this.width, this.height}); Map toMap() { return { 'id': id, 'name': name, 'length': length, 'width': width, 'height': height, }; } factory CartonSize.fromMap(Map map, String id) { return CartonSize( id: id, name: map['name'], length: map['length'], width: map['width'], height: map['height'], ); } @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; } }