From 603060fe5864a6af3626427f2fc057d4d9ffab27 Mon Sep 17 00:00:00 2001 From: marco Date: Thu, 18 Sep 2025 21:09:28 +0200 Subject: [PATCH] added classes for collections and bookmarks --- lib/model/bookmark.dart | 13 +++++++++++++ lib/model/collection.dart | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 lib/model/bookmark.dart create mode 100644 lib/model/collection.dart diff --git a/lib/model/bookmark.dart b/lib/model/bookmark.dart new file mode 100644 index 0000000..294060e --- /dev/null +++ b/lib/model/bookmark.dart @@ -0,0 +1,13 @@ +import 'package:hive/hive.dart'; + +class Bookmark extends HiveObject { + Bookmark({required this.name, required this.link}); + + factory Bookmark.fromJson(Map json) => + Bookmark(name: json['name'] as String, link: json['link'] as String); + + String link; + String name; + + Map toJson() => {'name': name, 'link': link}; +} diff --git a/lib/model/collection.dart b/lib/model/collection.dart new file mode 100644 index 0000000..1390beb --- /dev/null +++ b/lib/model/collection.dart @@ -0,0 +1,12 @@ +import 'package:hive/hive.dart'; + +class Collection extends HiveObject { + Collection({required this.name}); + + factory Collection.fromJson(Map json) => + Collection(name: json['name'] as String); + + String name; + + Map toJson() => {'name': name}; +}