registerWithEmailAndPassword static method

Future<User?> registerWithEmailAndPassword(
  1. BuildContext context, {
  2. required String email,
  3. required String password,
  4. dynamic onError(
    1. String
    )?,
  5. dynamic onRegisterSuccessful(
    1. User?
    )?,
})

Registers the Email and Password Combination on Firebase initiates a login and the AuthManager changes the screen to the destinationFragment Call this to create a new User and instantly log them in

Please enable Email and Password Authentication in your Firebase Authentication Console for this to work

context is necessary

email is required and is self-explanatory

password is also required and is self-explanatory

onError is a callback to handle any errors during the process

onRegisterSuccessful a Callback to perform any action after a successful SignIn

Implementation

static Future<User?> registerWithEmailAndPassword(
  BuildContext context, {
  required String email,
  required String password,
  Function(String)? onError,
  Function(User?)? onRegisterSuccessful,
}) async {
  return await Provider.of<FireAuthProvider>(context, listen: false)
      .registerWithEmailAndPassword(
    email: email,
    password: password,
    onError: onError,
    onRegisterSuccessful: onRegisterSuccessful,
  );
}