unlink method
Unlinks a provider from a user account.
A FirebaseAuthException maybe thrown with the following error code:
no-such-provider: Thrown if the user does not have this provider linked or when the provider ID given does not exist.
Implementation
Future<User> unlink(String providerId) async {
try {
_assertSignedOut(_auth);
final currentProviders = providerData.map((p) => p.providerId).toList();
if (providerId.providerId == ProviderId.unknown ||
!currentProviders.contains(providerId)) {
throw FirebaseAuthException(AuthErrorCode.NO_SUCH_PROVIDER);
}
await _auth._api.userAccount.deleteLinkedAccount(_idToken, providerId);
await reload();
return this;
} catch (e) {
rethrow;
}
}