apn_fb_login 0.0.4

  • README.md
  • Example
  • Installing
  • Versions
  • 77


A flutter plugin project that allows you to easily connect to Facebook and get your profile information


iOS configuration

Edit your Info.plist and add add the following:


Change ##APPID## and ##APPNAME##

Android configuration



Import the lib:

    import 'package:apn_fb_login/apn_fb_login.dart';

Define a FacebookConnect object:

    final _facebookConnect = new FacebookConnect(
        appId: '##APPID##',
        clientSecret: '##APPSECRET##'

Authenticate like so:

    ApnFbLogin.login(_facebookConnect).then((FacebookOAuthToken token) {
      this.token = token;
    }).catchError((dynamic error) {

Use the FacebookOAuthToken to get the graph/me result:

    ApnFbLogin.me().then((FacebookUser user) {
      this.user = user;
    }).catchError((dynamic error) {

See the project example for the complete example


For help getting started with Flutter, view our online documentation.

[0.0.4] - December 29, 2017

  • Upgraded to Gradle 4.1 and Gradle plugin 3.0.1 to match upgraded Firebase plugins

[0.0.3] - December 08, 2017

  • Fixed a NPE in the Android onActivityResult

[0.0.2] - December 03, 2017

  • Removed some unnecessary prints and files. Added url to repo

[0.0.1] - December 03, 2017

  • First release, basic auth and graph/me call to get FacebookUser.


import 'package:flutter/material.dart';
import 'package:apn_fb_login/apn_fb_login.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {
  bool isloading = false;
  FacebookOAuthToken token;
  FacebookUser user;
  String data;

  /// Get your app id and secret at https://developers.facebook.com
  final _facebookConnect = new FacebookConnect(
      appId: '##APPID##',
      clientSecret: '##APPSECRET##');

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Facebook login'),
        body: _body(),
        floatingActionButton: new FloatingActionButton(
          child: new Icon(token == null ? Icons.lock_open : Icons.face),
          onPressed: () {
            if (isloading) return;

            _setResult(true, null);
            if (token == null)

  void _doLogin() {
    ApnFbLogin.login(_facebookConnect).then((FacebookOAuthToken token) {
      this.token = token;
      _setResult(false, token.toString());
    }).catchError((dynamic error) {
      _setResult(false, null);

  void _queryMe() {
    ApnFbLogin.me().then((FacebookUser user) {
      this.user = user;
      _setResult(false, user.toString());
    }).catchError((dynamic error) {
      _setResult(false, null);

  Widget _body() {
    if (this.isloading) {
      return new Center(child: new CircularProgressIndicator());
    } else if (this.user != null) {
      return new Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            _textWidget("Got user!\nWelcome ${user.name}"),
            new ClipOval(child: new Image.network(this.user.avatarUrl)),
    } else if (this.token != null) {
      return _textWidget("Authorized!\nClick again to query /me");
    } else {
      return _textWidget("Click the button to connect with Facebook");

  void _setResult(bool loading, String data) {
    setState(() {
      this.isloading = loading;
      this.data = data;

  Widget _textWidget(String text) =>
      new Container(
        padding: new EdgeInsets.all(8.0),
        child: new Center(
          child: new Text(
            textAlign: TextAlign.center,


1. Depend on it

Add this to your package's pubspec.yaml file:

  apn_fb_login: "^0.0.4"

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:apn_fb_login/apn_fb_login.dart';
Version Uploaded Documentation Archive
0.0.4 Dec 29, 2017 Go to the documentation of apn_fb_login 0.0.4 Download apn_fb_login 0.0.4 archive
0.0.3 Dec 8, 2017 Go to the documentation of apn_fb_login 0.0.3 Download apn_fb_login 0.0.3 archive
0.0.2 Dec 3, 2017 Go to the documentation of apn_fb_login 0.0.2 Download apn_fb_login 0.0.2 archive
0.0.1 Dec 3, 2017 Go to the documentation of apn_fb_login 0.0.1 Download apn_fb_login 0.0.1 archive


We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6
  • Flutter: 0.3.2


Describes how popular the package is relative to other packages. [more]
79 / 100
Code health derived from static analysis. [more]
59 / 100
Reflects how tidy and up-to-date the package is. [more]
99 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 errors 1 hint.

    Strong-mode analysis of lib/apn_fb_login.dart failed with the following error:

    line: 18 col: 59
    The argument type '(Map<String, String>) → FacebookOAuthToken' can't be assigned to the parameter type '(dynamic) → FutureOr<FacebookOAuthToken>'.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.


Package Constraint Resolved Available
Direct dependencies
flutter 0.0.0
Transitive dependencies
collection 1.14.6 1.14.9
meta 1.1.2
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6