Added archive and unarchive

This commit is contained in:
Juan Gilsanz Polo
2024-02-26 22:14:41 +01:00
parent fa0441a0e4
commit 5faf08e597
9 changed files with 73 additions and 35 deletions

View File

@@ -118,8 +118,9 @@ class Bookmarks extends _$Bookmarks {
bookmark: bookmark,
apiClient: ref.read(apiClientProvider)!,
);
if (result != null) {
state.bookmarks = state.bookmarks.map((b) => b.id == result.id ? result : b).toList();
if (result == true) {
// On this case the bookmark always will pass from unarchived to archived
state.bookmarks = state.bookmarks.where((b) => b.id != bookmark.id).toList();
ref.notifyListeners();
}
}