createUser method
Creates a new user.
See https://firebase.google.com/docs/auth/admin/manage-users#create_a_user for code samples and detailed documentation.
Returns A Future fulfilled with the user data corresponding to the newly created user.
Implementation
Future<UserRecord> createUser(CreateRequest properties) async {
return _authRequestHandler
.createNewAccount(properties)
// Return the corresponding user record.
.then(getUser)
.onError<FirebaseAuthAdminException>((error, _) {
if (error.errorCode == AuthClientErrorCode.userNotFound) {
// Something must have happened after creating the user and then retrieving it.
throw FirebaseAuthAdminException(
AuthClientErrorCode.internalError,
'Unable to create the user record provided.',
);
}
throw error;
});
}