Files
kooltab/lib/models/tab_item.dart
T
2026-10-08 04:12:36 +02:00

49 lines
1.1 KiB
Dart

import 'package:flutter/foundation.dart';
import 'tab_item_purchase.dart';
class TabItem {
final String id;
final String tabId;
final String productId;
final String productName;
final int quantity;
final int unitPriceInCents;
final List<TabItemPurchase> purchases;
const TabItem({
required this.id,
required this.tabId,
required this.productId,
required this.productName,
required this.quantity,
required this.unitPriceInCents,
this.purchases = const [],
});
int get lineTotalInCents => quantity * unitPriceInCents;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is TabItem &&
id == other.id &&
tabId == other.tabId &&
productId == other.productId &&
productName == other.productName &&
quantity == other.quantity &&
unitPriceInCents == other.unitPriceInCents &&
listEquals(purchases, other.purchases);
@override
int get hashCode => Object.hash(
id,
tabId,
productId,
productName,
quantity,
unitPriceInCents,
Object.hashAll(purchases),
);
}