wpRegister method
Sends a request to register a user in WordPress with an email and
password.
username is optional; the server generates one from the email when it
is empty. firstName and lastName are optional. metaData is an
optional map of user meta ({"billing_phone": "..."}); only keys on the
site's allow-list are accepted. expiresIn and deviceName work as in
wpLogin.
Returns a WPUserRegisterResponse future.
Throws an UsernameTakenException if the username is taken,
UserAlreadyExistException if the email is in use,
InvalidEmailException if the email is not valid,
WeakPasswordException if the password is too short,
RegistrationDisabledException if registration is turned off,
MetaKeyNotAllowedException if a metaData key is not allowed,
TooManyAttemptsException if rate limited.
Implementation
Future<WPUserRegisterResponse> wpRegister(
{required String email,
required String password,
String? username,
String? firstName,
String? lastName,
Map<String, dynamic>? metaData,
int? expiresIn,
String? deviceName,
bool saveTokenToLocalStorage = true}) async {
return await _register(
wcRegister: false,
email: email,
password: password,
username: username,
firstName: firstName,
lastName: lastName,
metaData: metaData,
expiresIn: expiresIn,
deviceName: deviceName,
saveTokenToLocalStorage: saveTokenToLocalStorage,
);
}