google_sign_in_all 0.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 77

google_sign_in_all #

Google Sign In wrapper for Flutter - wraps google_sign_in and googleapis_auth to single API - to use it in Flutter web and mobile in easy way

Getting started #

TODO: add getting started

TODO #

  • [x] create abstraction
  • [x] wrap google_sign_in
  • [x] wrap googleapis_auth
  • [x] TEST: check if works on Flutter web
  • [x] TEST: check if works on Android/iOS
  • [ ] TEST: check if works with Firebase Auth from firebase package (Web)
  • [ ] TEST: check if works with Firebase Auth from firebase_auth package (Mobile)

[0.0.3] - 2019/09/27 #

  • expose GoogleUser from interface in web.dart and mobile.dart

[0.0.2] - 2019/09/26 #

  • Add getCurrentUser method

[0.0.1] - 2019/09/22 #

  • Wraps google_sign_in - sign in via Google in mobile
  • Wraps googleapis_auth - sign in via Google in browser (Flutter web)

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:google_sign_in_all/google_sign_in_all.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: LoginPage(),
    );
  }
}

class LoginPage extends HookWidget {
  @override
  Widget build(BuildContext context) {
    final signIn = useMemoized(
      () => setupGoogleSignIn(
        scopes: [
          'https://www.googleapis.com/auth/userinfo.email',
          'https://www.googleapis.com/auth/userinfo.profile',
        ],
        webClientId: 'webClientId',
        webSecret: 'webSecret',
      ),
    );

    final accessToken = useState('');
    final username = useState('');

    final onSignIn = () async {
      final credentials = await signIn.signIn();
      final user = await signIn.getCurrentUser();

      accessToken.value = credentials.accessToken;
      username.value = user.displayName;
    };

    return Scaffold(
      body: Column(
        children: <Widget>[
          Text('Access Token: ${accessToken.value}'),
          Text('Username: ${username.value}'),
          RaisedButton(
            child: Text('Sign In'),
            onPressed: onSignIn,
          )
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  google_sign_in_all: ^0.0.3

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:google_sign_in_all/google_sign_in_all.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
58
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
77
Learn more about scoring.

We analyzed this package on Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
google_sign_in ^4.0.7 4.3.0
googleapis_auth ^0.2.10 0.2.11+1
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.4
flutter_web_plugins 0.0.0
google_sign_in_platform_interface 1.1.0
google_sign_in_web 0.8.4 0.9.0
http 0.12.0+4
http_parser 3.1.4
js 0.6.1+1
matcher 0.12.6
meta 1.1.8
path 1.6.4
pedantic 1.9.0
quiver 2.1.3
sky_engine 0.0.99
source_span 1.7.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test