sendPasswordResetEmail method

Future<void> sendPasswordResetEmail({
  1. required String email,
  2. bool deleteThisPartOfCache = false,
})

Triggers the Shopify Authentication backend to send a password-reset email to the given email address, which must correspond to an existing user of your app.

Implementation

Future<void> sendPasswordResetEmail(
    {required String email, bool deleteThisPartOfCache = false}) async {
  final MutationOptions _options = MutationOptions(
      document: gql(customerRecoverMutation), variables: {'email': email});
  final QueryResult result = await _graphQLClient!.mutate(_options);
  checkForError(
    result,
    key: 'customerRecover',
    errorKey: 'customerUserErrors',
  );
  if (deleteThisPartOfCache) {
    _graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
  }
}