flutter_slack_oauth 0.4.0

pub package

flutter_slack_oauth #

A flutter OAuth package for Slack with a beautiful "Sign in with Slack" button.

Extensions: #

Usage #

To use this plugin, add flutter_slack_oauth as a dependency in your pubspec.yaml file.

Example #

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

void main() {
  runApp(new MaterialApp(
    home: new Scaffold(
      body: new Builder(
        builder: (BuildContext context) {
          return new Center(
            child: new SlackButton(
              clientId: "XXX_CLIENT_ID_XXX",
              clientSecret: "XXX_CLIENT_SECRET_XXX",
              redirectUrl: "https://kunstmaan.github.io/flutter_slack_oauth/success.html",
              onSuccess: () async {
                String accessToken = await Token.getLocalAccessToken();
                UserList users = await slack.getUsers(accessToken);
                
                Scaffold.of(context).showSnackBar(new SnackBar(
                  content: new Text('We found ' + users.users.length.toString() + " users"),
                ));
              },
              onFailure: () {
                Scaffold.of(context).showSnackBar(new SnackBar(
                  content: new Text('Slack Login Failed'),
                ));
              },
              onCancelledByUser: () {
                Scaffold.of(context).showSnackBar(new SnackBar(
                  content: new Text('Slack Login Cancelled by user'),
                ));
              },
            ),
          );
        },
      ),
    ),
  ));
}

Don't want to use the bundled OAuth flow? #

  • You can also provide your own custom onTap behaviour by manually importing package:flutter_slack_oauth/oauth/generic_slack_button.dart.
  • Or check out flutter_slack_oauth_firebase, where we use the generic_slack_button to integrate with Firebase Auth and Cloud Firestore.

[0.4.0] - 9 April 2019

  • Bumped dependencies for AndroidX compatibility

[0.3.1] - 25 January 2019

  • Bumped flutter_webview_plugin for Flutter 1.0 compatibility

[0.3.0] - 18 January 2019

  • Updated Slack icon to the most recent version
  • Refactored to Stateless widgets

[0.2.0] - 28 September 2018

  • BREAKING - Required for Flutter Release Preview 2
  • Updated deprecated dependencies and Dart 2 issues.

[0.1.1] - 10 April 2018

  • BREAKING - Required for Flutter Beta 2
  • Required changes to support Dart 2 (and Flutter Beta 2).

[0.1.0] - 30 March 2018

  • SlackButton now uses a GenericSlackButton which is not exposed by default.
  • GenericSlackButton can have a custom onTap callback so you can hook up your custom logic, such as binding Firebase Auth.
  • To use GenericSlackButton, you need to manually import package:flutter_slack_oauth/oauth/generic_slack_button.dart, it is not exposed by default.

[0.0.5] - 29 March 2018

  • Formatted with dartfmt

[0.0.4] - 19 March 2018

  • Slack WebView now has action bar so back behaviour is possible on iOS

[0.0.2] - 19 March 2018

  • Initial release
  • Provides a SlackButton widget which is styled like an official "Sign in with Slack" button.
  • Clicking a SlackButton starts a WebView, allowing the user to log in with Slack.
  • SlackButton requires a client id, client secret, and 3 callbacks: onSuccess, onFailure, and onCancelledByUser.
  • The resulting access token is stored in shared preferences (Android) and NSUserDefaults (iOS) (thanks https://github.com/flutter/plugins/tree/master/packages/shared_preferences)
  • Basic /api/users.identity call as PoC.
  • Basic /api/users.list call as PoC.

example/README.md

example #

flutter_slack_oauth example

Getting Started #

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

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_slack_oauth: ^0.4.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_slack_oauth/flutter_slack_oauth.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
41
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/flutter_slack_oauth.dart.

Run flutter format to format lib/flutter_slack_oauth.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
flutter_webview_plugin ^0.3.3 0.3.5
http ^0.12.0+2 0.12.0+2
shared_preferences ^0.5.1+2 0.5.3+4
Transitive dependencies
async 2.3.0
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.6 1.1.7
path 1.6.2
pedantic 1.8.0+1
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8

Admin