FacebookLogin class

FacebookLogin is a plugin for authenticating your users using the native Android & iOS Facebook Login SDKs.

The login methods return a FacebookLoginResult that contains relevant information about whether the user logged in, cancelled the login dialog, or if the login flow resulted in an error.

For example, this sample code illustrates how to handle the different cases:

final facebookLogin = FacebookLogin();
final result =
  await facebookLogin.logInWithReadPermissions(['email']);

switch (result.status) {
  case FacebookLoginStatus.loggedIn:
    _sendTokenToServer(result.accessToken.token);
    _showLoggedInUI();
    break;
  case FacebookLoginStatus.cancelledByUser:
    _showConvincingMessageOnUI();
    break;
  case FacebookLoginStatus.error:
    _showErrorOnUI();
    break;
}

Before using this plugin, some initial setup is required for the Android
and iOS clients. See the README for detailed instructions.

Constructors

FacebookLogin()

Properties

currentAccessToken → Future<FacebookAccessToken>
Retrieves the current access token for the application. [...]
read-only
isLoggedIn → Future<bool>
Returns whether the user is currently logged in and the access token is still valid or not. [...]
read-only
loginBehavior FacebookLoginBehavior
Controls how the login dialog should be presented. [...]
write-only
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

loginWithPublishPermissions(List<String> permissions) → Future<FacebookLoginResult>
Logs the user in with the requested publish permissions. [...]
logInWithReadPermissions(List<String> permissions) → Future<FacebookLoginResult>
Logs the user in with the requested read permissions. [...]
logOut() → Future<void>
Logs the currently logged in user out. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited

Constants

channel → const MethodChannel
const MethodChannel('com.roughike/flutter_facebook_login')