import 'package:flutter/foundation.dart'; import 'tab_item.dart'; class BarTab { final String id; final String customerName; final DateTime openedAt; final int version; final List items; const BarTab({ required this.id, required this.customerName, required this.openedAt, this.version = 0, required this.items, }); int get totalInCents { return items.fold(0, (total, item) => total + item.lineTotalInCents); } int get itemCount { return items.fold(0, (total, item) => total + item.quantity); } @override bool operator ==(Object other) => identical(this, other) || other is BarTab && id == other.id && customerName == other.customerName && openedAt == other.openedAt && version == other.version && listEquals(items, other.items); @override int get hashCode => Object.hash(id, customerName, openedAt, version, Object.hashAll(items)); }