36 lines
882 B
Dart
36 lines
882 B
Dart
class Bookmark {
|
|
Bookmark({
|
|
required this.collectionId,
|
|
required this.name,
|
|
required this.link,
|
|
required this.description,
|
|
int? createdAt,
|
|
}) : createdAt = createdAt ?? DateTime.now().millisecondsSinceEpoch;
|
|
|
|
factory Bookmark.fromJson(Map<String, dynamic> json) => Bookmark(
|
|
collectionId: json['collectionId'] as int,
|
|
name: json['name'] as String,
|
|
link: json['link'] as String,
|
|
description: json['description'] as String,
|
|
createdAt: json['createdAt'] as int,
|
|
);
|
|
|
|
int collectionId;
|
|
String link;
|
|
String name;
|
|
String description;
|
|
int createdAt;
|
|
|
|
int get id => createdAt;
|
|
|
|
DateTime get createdDate => DateTime.fromMillisecondsSinceEpoch(createdAt);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'collectionId': collectionId,
|
|
'name': name,
|
|
'link': link,
|
|
'description': description,
|
|
'createdAt': createdAt,
|
|
};
|
|
}
|