Line data Source code
1 : import 'package:plugin_platform_interface/plugin_platform_interface.dart'; 2 : 3 : import 'src/access_token.dart'; 4 : import 'src/method_cahnnel.dart'; 5 : import 'src/login_behavior.dart'; 6 : export 'src/access_token.dart'; 7 : export 'src/login_behavior.dart'; 8 : export 'src/facebook_auth_error_code.dart'; 9 : export 'src/facebook_auth_exception.dart'; 10 : export 'src/method_cahnnel.dart'; 11 : 12 : /// The interface that implementations of flutter_facebook_auth must implement. 13 : /// 14 : /// Platform implementations should extend this class rather than implement it as `flutter_facebook_auth` 15 : /// does not consider newly added methods to be breaking changes. Extending this class 16 : /// (using `extends`) ensures that the subclass will get the default implementation, while 17 : /// platform implementations that `implements` this interface will be broken by newly added 18 : /// [FacebookAuthPlatform] methods. 19 : abstract class FacebookAuthPlatform extends PlatformInterface { 20 : static const _token = Object(); 21 2 : FacebookAuthPlatform() : super(token: _token); 22 : 23 1 : static FacebookAuthPlatform _instance = MethodCahnnelFacebookAuth(); 24 : 25 : // ignore: unnecessary_getters_setters 26 2 : static FacebookAuthPlatform get instance => _instance; 27 : 28 : // ignore: unnecessary_getters_setters 29 1 : static set instance(FacebookAuthPlatform i) { 30 : _instance = i; 31 : } 32 : 33 : /// make a login request using the facebook SDK 34 : /// 35 : /// [permissions] permissions like ["email","public_profile"] 36 : /// 37 : /// [loginBehavior] (only Android) use this param to set the UI for the authentication, 38 : /// like webview, native app, or a dialog. 39 : Future<AccessToken> login({ 40 : List<String> permissions = const ['email', 'public_profile'], 41 : String loginBehavior = LoginBehavior.DIALOG_ONLY, 42 : }); 43 : 44 : /// Express login logs people in with their Facebook account across devices and platform. 45 : /// If a person logs into your app on Android and then changes devices, 46 : /// express login logs them in with their Facebook account, instead of asking for them to select a login method. 47 : /// 48 : /// This avoid creating duplicate accounts or failing to log in at all. To support the changes in Android 11, 49 : /// first add the following code to the queries element in your /app/manifest/AndroidManifest.xml file. 50 : /// For more info go to https://developers.facebook.com/docs/facebook-login/android 51 : Future<AccessToken?> expressLogin(); 52 : 53 : /// retrive the user information using the GraphAPI 54 : /// 55 : /// [fields] string of fields like birthday,email,hometown 56 : Future<Map<String, dynamic>> getUserData({ 57 : String fields = "name,email,picture.width(200)", 58 : }); 59 : 60 : /// Sign Out from Facebook 61 : Future<void> logOut(); 62 : 63 : /// if the user is logged return one instance of AccessToken 64 : Future<AccessToken?> get accessToken; 65 : }