removeBookmark method
Removes a bookmark from the list of bookmarks.
The bookmark is searched in all the lists, and if found, it is removed.
The bookmarks are saved to the storage after removing the bookmark.
Calls QuranCtrl.update
after removing the bookmark.
Implementation
void removeBookmark(int bookmarkId) {
// البحث في جميع القوائم لإيجاد الشارة المراد حذفها
bookmarks.forEach((colorCode, list) {
bookmarks.update(
colorCode,
(existingList) => existingList
.where((bookmark) => bookmark.id != bookmarkId)
.toList(),
);
});
_quranRepository.saveBookmarks(_flattenBookmarks());
update(['bookmarks']);
QuranCtrl.instance.update();
}