I am unlinking existing providers in Flutter for FirebaseAuth. I am unable to find the providers constants names like specified in the docs for iOS. However, I cannot find the provider id constants in Flutter. No documentaiton seems to find it. Instead of creating my own constants and keeping them updated, I would like to find the constants from the official packages.
Currently, I am checking them manually like facebook.com
, google.com
, apple.com
so on.
TextButton(
onPressed: () async {
final user = FirebaseAuth.instance.currentUser;
print(user);
if (user != null) {
final providersList = user.providerData;
final result = providersList.where((provider) =>
provider.providerId == 'facebook.com');
if (result.isNotEmpty) {
final facebookProvider = result.first;
user.unlink(facebookProvider.providerId);
}
}
},
child: const Text('Unlink Facebook'),
),
CodePudding user response:
The constants for those strings are defined here in the code for the plugin. But I don't immediately seem an enumeration or something like that of those constants or their string values.
Given what I see elsewhere in the source code of the package, it seems that using the string is the most common (and that constant probably a better alternative).