flutter_twitter_login 1.0.0 copy "flutter_twitter_login: ^1.0.0" to clipboard
flutter_twitter_login: ^1.0.0 copied to clipboard

outdatedDart 1 only

A Flutter plugin for allowing users to authenticate with native Android & iOS Twitter login SDKs.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_twitter_login/flutter_twitter_login.dart';

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

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

class _MyAppState extends State<MyApp> {
  static final TwitterLogin twitterLogin = new TwitterLogin(
    consumerKey: 'kkOvaF1Mowy4JTvCxKTV5O1WF',
    consumerSecret: 'ZECGsI6UUDBEUVGkJe4S5vd0FGqGxC3wMJCgsXgPRfjSwRFnyH',
  );

  String _message = 'Logged out.';

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Twitter login sample'),
        ),
        body: new Center(
          child: new Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              new Text(_message),
              new RaisedButton(
                child: new Text('Log in'),
                onPressed: () async {
                  final TwitterLoginResult result =
                      await twitterLogin.authorize();
                  String newMessage;

                  switch (result.status) {
                    case TwitterLoginStatus.loggedIn:
                      newMessage =
                          'Logged in! username: ${result.session.username}';
                      break;
                    case TwitterLoginStatus.cancelledByUser:
                      newMessage = 'Login cancelled by user.';
                      break;
                    case TwitterLoginStatus.error:
                      newMessage = 'Login error: ${result.errorMessage}';
                      break;
                  }

                  setState(() {
                    _message = newMessage;
                  });
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
35
likes
0
pub points
71%
popularity

Publisher

verified publisheriiro.dev

A Flutter plugin for allowing users to authenticate with native Android &amp; iOS Twitter login SDKs.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_twitter_login