getAllBlogs method
Future<List<Blog> ?>
getAllBlogs({
- bool deleteThisPartOfCache = false,
- SortKeyBlog sortKeyBlog = SortKeyBlog.HANDLE,
- bool reverseBlogs = false,
- bool reverseArticles = false,
Implementation
Future<List<Blog>?> getAllBlogs(
{bool deleteThisPartOfCache = false,
SortKeyBlog sortKeyBlog = SortKeyBlog.HANDLE,
bool reverseBlogs = false,
bool reverseArticles = false}) async {
final WatchQueryOptions _options =
WatchQueryOptions(document: gql(getAllBlogsQuery), variables: {
'reverseBlogs': reverseBlogs,
'reverseArticles': reverseArticles,
'sortKey': sortKeyBlog.parseToString(),
});
final QueryResult result = await _graphQLClient!.query(_options);
checkForError(result);
if (deleteThisPartOfCache) {
_graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
}
return (Blogs.fromGraphJson((result.data ?? const {})["blogs"] ?? const {}))
.blogList;
}