fetchSignInMethodsForEmail method

Future<List<String>> fetchSignInMethodsForEmail(
  1. String email
)

Fetches the sign-in methods available for the provided email.

Implementation

Future<List<String>> fetchSignInMethodsForEmail(String email) async {
  try {
    final authPlatform = FirebaseAuthPlatform.instanceFor(
      app: _auth.app,
      pluginConstants: _auth.pluginConstants,
    );
    final providers = await authPlatform.fetchSignInMethodsForEmail(email);
    return providers;
  } catch (err) {
    if (err is FirebaseAuthException) {
      /// When email is not found (iOS?)
      if (err.code == 'null-error') {
        return [];
      }
      throw AuthDataServiceException.fromRdevException(err.toRdevException());
    }
    throw AuthDataServiceException(
      message: err.toString(),
    );
  }
}