Future<FirebaseUser> login({List<String> userData, var loginCallback, var cancelledCallback,
var errorCallback}) async {
var facebookLogin = FacebookLogin();
var facebookLoginResult = await facebookLogin.logInWithReadPermissions(['email']);
switch (facebookLoginResult.status) {
case FacebookLoginStatus.error:
print("Error");
break;
case FacebookLoginStatus.cancelledByUser:
print("CancelledByUser");
break;
case FacebookLoginStatus.loggedIn:
print("LoggedIn");
break;
}
}
Using flutter_facebook_login plugin and it always throws this error.Couldn't figure out where am i going wrong. Here is the logcat for the error.
MissingPluginException(No implementation found for method loginWithReadPermissions on channel com.roughike/flutter_facebook_login)
E/flutter ( 6174): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:278:7)
E/flutter ( 6174): <asynchronous suspension>
E/flutter ( 6174): #1 FacebookLogin.logInWithReadPermissions (package:flutter_facebook_login/flutter_facebook_login.dart:101:23)
E/flutter ( 6174): <asynchronous suspension>
E/flutter ( 6174): #2 FacebookAuth.login (package:shout_out/util/social_login.dart:26:25)
Ok once you are at the firebase project you can go to Authentication and then select sign-in methods. 4. Select the Facebook option, it will ask for your App ID and App secret the one you got from Facebook for developers.
MissingPluginException usually occurs when you add a plugin and doesnt re-run your app from the start.
Try to kill your application and again run it. The problem will go away.
Edit
Facebook sdk for flutter requires to have some additions in your manifest file (For android), the changes are documented in the plugin documentation.
AndroidX support #
if you don't know what android X is, Simply use this one (1.2.0) and the Error will be Solved
if you want to avoid AndroidX, use version 1.2.0.
• flutter_facebook_login: ^1.2.0
if you want to use the latest version please refer about Android X
for AndroidX Flutter projects, use versions 2.0.0 and up.
• flutter_facebook_login: ^2.0.0
For android studio go to the file > invalidate caches / restart.....
it is working for me so, I hope it will work for you...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With