added abilty to edit and delete collections
This commit is contained in:
@@ -7,12 +7,28 @@ class Collection {
|
||||
createdAt: json['createdAt'] as int,
|
||||
);
|
||||
|
||||
String name;
|
||||
int createdAt; // used as Id with millisecondsSinceEpoch
|
||||
String name;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (other is Collection) {
|
||||
return hashCode == other.hashCode;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
|
||||
int get id => createdAt;
|
||||
|
||||
DateTime get createdDate => DateTime.fromMillisecondsSinceEpoch(createdAt);
|
||||
|
||||
Map<String, dynamic> toJson() => {'name': name, 'createdAt': createdAt};
|
||||
|
||||
Collection copyWith({String? name}) {
|
||||
return Collection(name: name ?? this.name, createdAt: createdAt);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user