saveBookmarks method

void saveBookmarks(
  1. List<BookmarkModel> bookmarks
)

Saves the list of bookmarks to persistent storage.

This method uses the GetStorage package to write the provided list of BookmarkModel instances to storage. The bookmarks can be retrieved later using the appropriate read method from GetStorage.

bookmarks - A list of BookmarkModel instances to be saved.

Implementation

void saveBookmarks(List<BookmarkModel> bookmarks) => GetStorage().write(
      _StorageConstants().bookmarks,
      bookmarks.map((bookmark) => jsonEncode(bookmark._toJson())).toList(),
    );