getAllBlogs method
Future<List<Blog> ?>
getAllBlogs({
- SortKeyBlog sortKeyBlog = SortKeyBlog.HANDLE,
- bool reverseBlogs = false,
- bool reverseArticles = false,
Implementation
Future<List<Blog>?> getAllBlogs(
{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(),
},
fetchPolicy: ShopifyConfig.fetchPolicy,
);
final QueryResult result = await _graphQLClient!.query(_options);
checkForError(result);
return (Blogs.fromGraphJson((result.data ?? const {})["blogs"] ?? const {}))
.blogList;
}