signOutCurrentUser method

Future<void> signOutCurrentUser({
  1. bool deleteThisPartOfCache = false,
})

Signs out the current user and clears it from the disk cache.

Implementation

Future<void> signOutCurrentUser({bool deleteThisPartOfCache = false}) async {
  final MutationOptions _options = MutationOptions(
      document: gql(accessTokenDeleteMutation),
      variables: {'customerAccessToken': await currentCustomerAccessToken});
  await _setShopifyUser(null, null);
  final QueryResult result = await _graphQLClient!.mutate(_options);
  checkForError(
    result,
    key: 'customerAccessTokenDelete',
    errorKey: 'userErrors',
  );
  if (deleteThisPartOfCache) {
    _graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
  }
}