createUserWithEmailAndPassword method
Tries to create a new user account with the given email address and password.
Implementation
Future<ShopifyUser> createUserWithEmailAndPassword({
  String? firstName,
  String? lastName,
  required String email,
  required String password,
  bool deleteThisPartOfCache = false,
}) async {
  final MutationOptions _options = MutationOptions(
    document: gql(customerCreateMutation),
    variables: {
      'firstName': firstName,
      'lastName': lastName,
      'email': email,
      'password': password,
    },
  );
  final QueryResult result = await _graphQLClient!.mutate(_options);
  log(result.exception.toString());
  checkForError(
    result,
    key: 'customerCreate',
    errorKey: 'customerUserErrors',
  );
  final shopifyUser = ShopifyUser.fromGraphJson(
      (result.data!['customerCreate'] ?? const {})['customer']);
  final String? customerAccessToken = await _createAccessToken(
    email,
    password,
  );
  await _setShopifyUser(
    customerAccessToken,
    _shopifyUser[ShopifyConfig.storeUrl],
  );
  if (deleteThisPartOfCache) {
    _graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
  }
  return shopifyUser;
}