getAllPages method

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

Returns a List of Page.

Returns All Page of the Shop.

Implementation

Future<List<Page>?> getAllPages({
  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,
    },
    fetchPolicy: ShopifyConfig.fetchPolicy,
  );
  final QueryResult result = await _graphQLClient!.query(_options);
  checkForError(result);
  return (Pages.fromGraphJson((result.data ?? const {})["pages"] ?? const {}))
      .pageList;
}