feat: add equality operators, make history screen paginated, random performance updates
This commit is contained in:
@@ -30,4 +30,35 @@ class BarTab {
|
||||
}
|
||||
|
||||
bool get isOpen => status == 'open';
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is BarTab &&
|
||||
id == other.id &&
|
||||
customerName == other.customerName &&
|
||||
status == other.status &&
|
||||
openedAt == other.openedAt &&
|
||||
closedAt == other.closedAt &&
|
||||
_listEquals(items, other.items);
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
id,
|
||||
customerName,
|
||||
status,
|
||||
openedAt,
|
||||
closedAt,
|
||||
Object.hashAll(items),
|
||||
);
|
||||
}
|
||||
|
||||
bool _listEquals<T>(List<T>? a, List<T>? b) {
|
||||
if (identical(a, b)) return true;
|
||||
if (a == null || b == null) return a == b;
|
||||
if (a.length != b.length) return false;
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
if (a[i] != b[i]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user