facebook_sdk 0.0.7 copy "facebook_sdk: ^0.0.7" to clipboard
facebook_sdk: ^0.0.7 copied to clipboard

A flutter plugin for integrating the Facebook SDK. For now only link-content-sharing is implemented using the Facebook Sharing (https://developers.facebook.com/docs/sharing/)

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:facebook_sdk/facebook_sdk.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  void shareLink() async {
    String result = await FacebookSdk.shareLinkContent("https://www.flyingkiwi.nl");
    print(result);
  }

  void fbLogin() async {
    // await FacebookSdk.logOut();
    FacebookLoginResult result = await FacebookSdk.logInWithReadPermissions(['email']);
    print(result);
    print(result.status);
    print(result.accessToken);
    print(result.accessToken.token);
    print(result.errorMessage);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: <Widget>[
            FlatButton(
              child: Text("Login"),
              onPressed: () {
                fbLogin();
              },
            ),
            FlatButton(
              child: Text("Share"),
              onPressed: () {
                shareLink();
              },
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
30
pub points
16%
popularity

Publisher

unverified uploader

A flutter plugin for integrating the Facebook SDK. For now only link-content-sharing is implemented using the Facebook Sharing (https://developers.facebook.com/docs/sharing/)

Homepage

License

unknown (LICENSE)

Dependencies

collection, flutter

More

Packages that depend on facebook_sdk