getAllPages method

Future<List<Page>?> getAllPages({
  1. bool deleteThisPartOfCache = false,
  2. SortKeyPage sortKeyPage = SortKeyPage.ID,
  3. bool reversePages = false,
  4. String? pagesQuery,
})

Returns a List of Page.

Returns All Page of the Shop.

Implementation

Future<List<Page>?> getAllPages({
  bool deleteThisPartOfCache = false,
  SortKeyPage sortKeyPage = SortKeyPage.ID,
  bool reversePages = false,
  String? pagesQuery,
}) async {
  final WatchQueryOptions _options = WatchQueryOptions(
    document: gql(getAllPagesQuery),
    variables: {
      'reversePages': reversePages,
      'sortKey': sortKeyPage.parseToString(),
      'pagesQuery': pagesQuery,
    },
  );
  final QueryResult result = await _graphQLClient!.query(_options);
  checkForError(result);
  if (deleteThisPartOfCache) {
    _graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
  }
  return (Pages.fromGraphJson((result.data ?? const {})["pages"] ?? const {}))
      .pageList;
}