add uuid lib and use it
This commit is contained in:
parent
96c89170a0
commit
48e7d76e1a
3 changed files with 30 additions and 2 deletions
|
@ -1,3 +1,5 @@
|
|||
import 'package:uuid/uuid.dart';
|
||||
|
||||
final now = DateTime.now();
|
||||
|
||||
enum TransaktionArt { monatlBeitrag, aufladung, einkauf, korrektur }
|
||||
|
@ -27,7 +29,7 @@ class Product {
|
|||
final int id = 0;
|
||||
final String name;
|
||||
final Unit unit;
|
||||
final double price; //pro Kilogramm oder Stück
|
||||
final double price; //pro Kilogramm oder Stück, d.h. pro unit
|
||||
final double vat;
|
||||
final Category category;
|
||||
const Product(this.name, this.unit, this.price, this.vat, this.category);
|
||||
|
@ -42,8 +44,9 @@ class Purchase {
|
|||
class Basket {
|
||||
Map<Product, int> purchases;
|
||||
double price;
|
||||
String guid;
|
||||
|
||||
Basket(this.purchases, this.price);
|
||||
Basket(this.purchases, this.price): guid = const Uuid().v4();
|
||||
|
||||
void addItem(Product product, int quantity) {
|
||||
if (purchases.containsKey(product)) {
|
||||
|
|
|
@ -41,6 +41,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.17.1"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -184,6 +192,22 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.1"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.2"
|
||||
uuid:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: uuid
|
||||
sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.7"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -28,6 +28,7 @@ environment:
|
|||
# the latest version available on pub.dev. To see which dependencies have newer
|
||||
# versions available, run `flutter pub outdated`.
|
||||
dependencies:
|
||||
uuid: ^3.0.4
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
|
|
Loading…
Reference in a new issue