firebase_phoneauth 0.0.1

  • Readme
  • Changelog
  • Installing
  • new55

Firebase Phone Authentication. #

A new Flutter package project.

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Flutter package to Easy Implimaintaion of Firebase Phone Authentication and also provide animated, 🥰 Attractive, 🎨stylish Login Page for phone authentication. #

1.Firebase Phone Authentication

Introduction #

Firebase Phone Authentication library is built upon Flutter firebase_auth library. This API will be useful to create phone authentication animated, login page in Flutter easily.

1.Mobile Number verification 2. OTP Validation
This is Main login Window which has one Mobile number Filed And Verify Button for verification (Same as Login Page) as you can see below. This is Alert Dialog For OTP validation which has OTP filed which is showed after click on varify Button as you can see below.

Implementation #

Implementation of Firebase Phone Authentication library is so easy. You can check /test directory for demo. Let's have look on basic steps of implementation.

Create Firebase-PhoneAuthentication Instance #

As there are two types of dialogs in library. Material Dialogs are instantiated as follows.

i. Phone Authentication -

FirebasePhoneAuth class is used to create Phone Authentication . Its dynamic state class is used to instantiate it.




       FirebasePhoneAuth(
       
      theamColor: Colors.redAccent,
      
      title: "HealthCare",
      
      imgPath:"assets/images/doctors.png",
      
      redirectTo: "/homepage", // pass the homepage of your project
    ) 





ii. How to include in Main File.

Create a file like authservice.dart #

import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'phoneauth.dart';
import 'homepage.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Phone Authentication',
      routes: <String, WidgetBuilder>{
        '/homepage': (BuildContext context) => DashboardPage(),
        '/loginpage': (BuildContext context) => MyApp(),
      },
      theme: ThemeData(
        primarySwatch: Colors.orange,
      ),
      home: 
      FirebasePhoneAuth(
      theamColor: Colors.redAccent,
      title: "HealthCare",
      imgPath:"assets/images/doctors.png",
      redirectTo: "/homepage",

      ),
    );
  }
}

iii. Check User Login or not using following Code main.dart #


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

  FirebaseAuth _auth = FirebaseAuth.instance;

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // Set default home.
  Widget _defaultHome = new MyApp();

  // Get result of the login function.
   FirebaseUser currentUser = await _auth.currentUser();
  //  _defaultHome = new DashboardPage();
      if (currentUser != null) {
        // User is logged in
        _defaultHome = new DashboardPage();
      } 
  // Run app!
  runApp(new MaterialApp(
    title: 'App',
    home: _defaultHome,
    routes: <String, WidgetBuilder>{
      // Set routes for using the Navigator.
      '/homepage': (BuildContext context) => new DashboardPage(),
      '/loginpage': (BuildContext context) => new MyApp()
    },
  ));
}


Credits #

This library is built using following open-source libraries.

  • [Material Components for Flutter]
  • [Firebase_Auth]

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.

Use this package as a library

1. Depend on it

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


dependencies:
  firebase_phoneauth: ^0.0.1

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

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

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Health suggestions

Format lib/firebase_phoneauth.dart.

Run flutter format to format lib/firebase_phoneauth.dart.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (flutter_map).

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and firebase_phoneauth.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

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.

The package description is too short. (-4 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.1.0 <3.0.0
firebase_auth ^0.16.0 0.16.1
flutter 0.0.0
flutter_map ^0.8.2 0.8.2 0.9.0
google_sign_in ^4.4.4 4.5.1
Transitive dependencies
ansicolor 1.0.2
async 2.4.1
cached_network_image 2.2.0+1 2.3.0-beta.1+1
charcode 1.1.3
clock 1.0.1
collection 1.14.12
console_log_handler 1.1.6
convert 2.1.1
crypto 2.1.5
file 5.1.0
firebase 7.3.0
firebase_auth_platform_interface 1.1.8
firebase_auth_web 0.1.3+1
firebase_core 0.4.5
firebase_core_platform_interface 1.0.4
firebase_core_web 0.1.1+2
flutter_cache_manager 1.3.0
flutter_image 3.0.0
flutter_web_plugins 0.0.0
google_sign_in_platform_interface 1.1.2
google_sign_in_web 0.9.1+1
http 0.12.1
http_parser 3.1.4
intl 0.16.1
js 0.6.1+1
latlong 0.6.1
logging 0.11.4
matcher 0.12.6
meta 1.1.8
path 1.7.0
path_provider 1.6.10
path_provider_linux 0.0.1+1
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
pedantic 1.9.0
platform 2.2.1
plugin_platform_interface 1.0.2
positioned_tap_detector 1.0.3
process 3.0.13
quiver 2.1.3
rxdart 0.24.1
sky_engine 0.0.99
source_span 1.7.0
sqflite 1.3.0+2 1.3.1-dev.1
sqflite_common 1.0.1
stack_trace 1.9.3
string_scanner 1.0.5
synchronized 2.2.0
term_glyph 1.1.0
transparent_image 1.0.0
tuple 1.0.3
typed_data 1.1.6
uuid 2.0.4
validate 1.7.0
vector_math 2.0.8
xdg_directories 0.1.0
Dev dependencies
flutter_test