Facebook Login With Flutter

6,121

Solution 1

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.

Solution 2

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

Solution 3

For android studio go to the file > invalidate caches / restart.....

it is working for me so, I hope it will work for you...

enter image description here

Share:
6,121
ujjwal mainali
Author by

ujjwal mainali

Updated on December 06, 2022

Comments

  • ujjwal mainali
    ujjwal mainali over 1 year
    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)