flutter_facebook_connect 0.0.4+1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 91

flutter_facebook_connect

DISCLAIMER

No maintenance on this package anymore. Prefer to use flutter_facebook_login

Facebook Connect for Flutter

Easy way to connect users to Facebook inside your application via OAuth2

Usage

See configuration for flutter_webview_plugin

Redirection Url need to be http://localhost:8080.

iOS Configuration

Add following lines to Info.plist

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>localhost:8080</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>

Dart Code

Using FacebookConnect class

final _facebookConnect = new FacebookConnect(
          appId: '<APP_ID>',
          clientSecret: '<CLIENT_SECRET');

FacebookOAuthToken token = await _facebookConnect.login();

Using FacebookLoginButton widget

 new FacebookLoginButton(
          appId: '<APP_ID>',
          clientSecret: '<CLIENT_SECRET>',
          scope: [FacebookAuthScope.publicProfile],
          onConnect: (api, token) {
           ...
          }),

Features and bugs

Please file feature requests and bugs at the issue tracker.

Changelog

0.0.4

  • fix #4
  • fix facebook logo size

0.0.3

  • Add FacebookLoginButton Widget
  • Remove FacebookOptions class

0.0.2

  • Optional token storage

0.0.1

  • Initial version, created by Stagehand

example/lib/main.dart

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

void main() {
  runApp(new MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  FacebookConnect _connect;

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        appBar: new AppBar(
          title: new Text(widget.title),
        ),
        body: new Center(
          child: new Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              new Container(
                child: new Text(
                    _connect?.token != null ? "connected" : "not connected"),
                padding: new EdgeInsets.all(8.0),
              ),
              new FacebookLoginButton(
                  appId: '<APP_ID>',
                  clientSecret: '<CLIENT_SECRET>',
                  scope: [FacebookAuthScope.publicProfile],
                  cookie: false,
                  onConnect: (api, token) {
                    _connect = api;
                    print(token);
                    setState(() {});
                  }),
              new FlatButton(
                  onPressed: () {
                    _connect?.logout();
                    setState(() {});
                  },
                  child: new Text("Logout"))
            ],
          ),
        ));
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_facebook_connect: "^0.0.4+1"

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


      import 'package:flutter_facebook_connect/flutter_facebook_connect.dart';
  
Version Uploaded Documentation Archive
0.0.4+1 Mar 11, 2018 Go to the documentation of flutter_facebook_connect 0.0.4+1 Download flutter_facebook_connect 0.0.4+1 archive
0.0.4 Jan 20, 2018 Go to the documentation of flutter_facebook_connect 0.0.4 Download flutter_facebook_connect 0.0.4 archive
0.0.3 Jul 30, 2017 Go to the documentation of flutter_facebook_connect 0.0.3 Download flutter_facebook_connect 0.0.3 archive
0.0.2 Jul 24, 2017 Go to the documentation of flutter_facebook_connect 0.0.2 Download flutter_facebook_connect 0.0.2 archive
0.0.1 Jul 24, 2017 Go to the documentation of flutter_facebook_connect 0.0.1 Download flutter_facebook_connect 0.0.1 archive

Analysis

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

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3
  • Flutter: 0.5.4

Scores

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

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • 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.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 4 hints.

    Strong-mode analysis of lib/src/flutter_facebook_connect_base.dart gave the following hint:

    line: 98 col: 47
    'JSON' is deprecated and shouldn't be used.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0
flutter 0.0.0
flutter_webview_plugin ^0.0.5 0.0.9+1 0.1.6
http ^0.11.3 0.11.3+16
meta ^1.0.0 1.1.5
shared_preferences ^0.2.4+1 0.2.5 0.4.2
Transitive dependencies
async 2.0.7
charcode 1.1.1
collection 1.14.6 1.14.10
http_parser 3.1.2
path 1.6.0 1.6.1
sky_engine 0.0.99
source_span 1.4.0
string_scanner 1.0.2
typed_data 1.1.5
vector_math 2.0.6 2.0.7
Dev dependencies
test ^0.12.0