createUser method
Creates a new user.
Implementation
Future<UserRecord> createUser({
bool? disabled,
String? displayName,
String? email,
bool? emailVerified,
String? password,
String? phoneNumber,
String? photoUrl,
String? uid,
}) async {
try {
uid = await _authRequestHandler.createNewAccount(CreateEditAccountRequest(
disabled: disabled,
displayName: displayName,
email: email,
emailVerified: emailVerified,
password: password,
phoneNumber: phoneNumber,
photoUrl: photoUrl,
uid: uid));
// Return the corresponding user record.
return await getUser(uid);
} on FirebaseException catch (error) {
if (error.code == 'auth/user-not-found') {
// Something must have happened after creating the user and then retrieving it.
throw FirebaseAuthError.internalError(
'Unable to create the user record provided.');
}
rethrow;
}
}