firebase_auth 0.0.2

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

firebase_auth #

pub package

A new flutter plugin project.

Getting Started #

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

0.0.2 #

  • Bump buildToolsVersion to 25.0.3

0.0.1 #

  • Initial Release

example/lib/main.dart

// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';

final FirebaseAuth auth = FirebaseAuth.instance;
final GoogleSignIn googleSignIn = new GoogleSignIn();

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Firebase Auth Demo',
      home: new MyHomePage(title: 'Firebase Auth Demo'),
    );
  }
}

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> {
  Future<String> _message = new Future<String>.value('');

  Future<String> _testSignInAnonymously() async {
    FirebaseUser user = await auth.signInAnonymously();
    assert(user != null);
    assert(user == auth.currentUser);
    assert(user.isAnonymous);
    assert(!user.isEmailVerified);
    if (Platform.isIOS) {
      // Anonymous auth doesn't show up as a provider on iOS
      assert(user.providerData.length == 0);
    } else if (Platform.isAndroid) {
      // Anonymous auth does show up as a provider on Android
      assert(user.providerData.length == 1);
      assert(user.providerData[0].providerId == 'firebase');
      assert(user.providerData[0].uid != null);
      assert(user.providerData[0].displayName == null);
      assert(user.providerData[0].photoUrl == null);
      assert(user.providerData[0].email == null);
    }
    return 'signInAnonymously succeeded: $user';
  }

  Future<String> _testSignInWithGoogle() async {
    GoogleSignInAccount googleUser = await googleSignIn.signIn();
    GoogleSignInAuthentication googleAuth = await googleUser.authentication;
    FirebaseUser user = await auth.signInWithGoogle(
      accessToken: googleAuth.accessToken,
      idToken: googleAuth.idToken,
    );
    assert(user.email != null);
    assert(user.displayName != null);
    return 'signInWithGoogle succeeded: $user';
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      ),
      body: new Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          new MaterialButton(
            child: const Text('Test signInAnonymously'),
            onPressed: () {
              setState(() {
                _message = _testSignInAnonymously();
              });
            }
          ),
          new MaterialButton(
            child: const Text('Test signInWithGoogle'),
            onPressed: () {
              setState(() {
                _message = _testSignInWithGoogle();
              });
            }
          ),
          new FutureBuilder(
            future: _message,
            builder: (_, AsyncSnapshot<String> snapshot) {
              return new Text(
                snapshot.data ?? '',
                style: const TextStyle(color: const Color.fromARGB(255, 0, 155, 0))
              );
            }
          ),
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  firebase_auth: ^0.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or 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:firebase_auth/firebase_auth.dart';
  
Version Uploaded Documentation Archive
0.8.1+4 Feb 26, 2019 Go to the documentation of firebase_auth 0.8.1+4 Download firebase_auth 0.8.1+4 archive
0.8.1+3 Feb 22, 2019 Go to the documentation of firebase_auth 0.8.1+3 Download firebase_auth 0.8.1+3 archive
0.8.1+2 Feb 21, 2019 Go to the documentation of firebase_auth 0.8.1+2 Download firebase_auth 0.8.1+2 archive
0.8.1+1 Feb 15, 2019 Go to the documentation of firebase_auth 0.8.1+1 Download firebase_auth 0.8.1+1 archive
0.8.1 Feb 11, 2019 Go to the documentation of firebase_auth 0.8.1 Download firebase_auth 0.8.1 archive
0.8.0+3 Feb 8, 2019 Go to the documentation of firebase_auth 0.8.0+3 Download firebase_auth 0.8.0+3 archive
0.8.0+1 Jan 25, 2019 Go to the documentation of firebase_auth 0.8.0+1 Download firebase_auth 0.8.0+1 archive
0.8.0 Jan 24, 2019 Go to the documentation of firebase_auth 0.8.0 Download firebase_auth 0.8.0 archive
0.7.0 Jan 29, 2019 Go to the documentation of firebase_auth 0.7.0 Download firebase_auth 0.7.0 archive
0.6.6 Nov 21, 2018 Go to the documentation of firebase_auth 0.6.6 Download firebase_auth 0.6.6 archive

All 55 versions...

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

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0