registerWithEmail method
Register a new user with email and password
Implementation
Future<void> registerWithEmail(
String email, String password, String displayName) async {
_updateState(const AuthState.loading());
try {
verbose('Registering with email...');
final _UserCredential credential = await _firebase
.auth()
.createUserWithEmailAndPassword(email, password)
.toDart;
// Update display name
if (credential.user != null) {
await credential.user!
.updateProfile(_ProfileUpdate(displayName: displayName))
.toDart;
}
// Auth state listener will handle the rest
} catch (e) {
error('Email registration failed: $e');
_updateState(AuthState.withError(_parseFirebaseError(e)));
}
}