Skip to content

FirebaseAuth: How are the errors reported #1106

@kroikie

Description

@kroikie

Hi,
Im currently writing a sample project using FirebaseAuth. When looking at teh sourcecode I see:

 /// Tries to create a new user account with the given email address and password.
  ///
  /// If successful, it also signs the user in into the app and updates
  /// the [onAuthStateChanged] stream.
  ///
  /// Errors:
  ///   • `ERROR_WEAK_PASSWORD` - If the password is not strong enough.
  ///   • `ERROR_INVALID_EMAIL` - If the email address is malformed.
  ///   • `ERROR_EMAIL_ALREADY_IN_USE` - If the email is already in use by a different account.
  Future<FirebaseUser> createUserWithEmailAndPassword({
    @required String email,
    @required String password,
  }) async {
    assert(email != null);
    assert(password != null);
    final Map<String, dynamic> data =
        await channel.invokeMapMethod<String, dynamic>(
      'createUserWithEmailAndPassword',
      <String, String>{'email': email, 'password': password, 'app': app.name},
    );
    final FirebaseUser currentUser = FirebaseUser._(data, app);
    return currentUser;
  }

My question is how are the named erros reported? The method only returns a FirebaseUser and no Exception is thrown in the function. What am I missing?
Thanks
Thomas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions