firebase_auth_simplify 0.4.4 copy "firebase_auth_simplify: ^0.4.4" to clipboard
firebase_auth_simplify: ^0.4.4 copied to clipboard

outdated

A high-level framework of Firebase Auth package that wraps several lines of codes to one line in order to easily use sign-in and out function.

example/lib/main.dart

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

import 'package:provider/provider.dart';

import 'login_page.dart';
import 'landing_page.dart';
import 'user_credential_provider.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: AppPage(),
    );
  }
}

class AppPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    print(">>> Build [App] Page");

    return Scaffold(
      appBar: AppBar(title: Text("Firebase Auth Example")),
      body: _buildBody(),
    );
  }

  Widget _buildBody() {
    return StreamBuilder<FirebaseUser>(
      stream: FirebaseAuth.instance.onAuthStateChanged,
      builder: (_, snapshot) {
        if (snapshot.connectionState == ConnectionState.active) {
          if (snapshot.data == null) {
            return ChangeNotifierProvider(
              create: (_) => UserCredentialProvider(),
              child: LoginPage(),
            );
          } else {
            return ChangeNotifierProvider(
              create: (_) => UserCredentialProvider(),
              child: LandingPage(),
            );
          }
        } else {
          return _buildLoadingIndicator();
        }
      },
    );
  }

  Widget _buildLoadingIndicator() {
    return Center(
      child: SizedBox(
        child: CircularProgressIndicator(),
        height: 25,
        width: 25,
      ),
    );
  }
}
23
likes
0
pub points
33%
popularity

Publisher

unverified uploader

A high-level framework of Firebase Auth package that wraps several lines of codes to one line in order to easily use sign-in and out function.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cloud_functions, firebase_analytics, firebase_auth, flutter, flutter_facebook_login, flutter_kakao_login, google_sign_in, http, provider

More

Packages that depend on firebase_auth_simplify