getPageByHandle method

Future<Page> getPageByHandle(
  1. String handle, {
  2. bool deleteThisPartOfCache = false,
})

Returns a Page.

Returns the Page that is associated to the handle.

Implementation

Future<Page> getPageByHandle(
  String handle, {
  bool deleteThisPartOfCache = false,
}) async {
  final QueryOptions _options = WatchQueryOptions(
    document: gql(getPageByHandleQuery),
    variables: {
      'handle': handle,
    },
  );
  final QueryResult result = await _graphQLClient!.query(_options);
  checkForError(result);
  var response = result.data!['pageByHandle'];
  if (deleteThisPartOfCache) {
    _graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
  }
  return Page.fromJson(response);
}