phone_auth_simple 1.0.0

Phone Auth Simple #

This package help you to do phone verification in just 6 lines of code. Isn't this great.

Installation #

Step 1- Connect Your app with firebase.
Step 2- Enable Phone Authentication in Firebase.
Step 3-Add phone_auth_simple: in your pubspec.yaml dependencies.

How to use #

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

class Test extends StatefulWidget {
  _TestState createState() => _TestState();
}

class _TestState extends State<Test> {
  @override
  Widget build(BuildContext context) {
    return PhoneAuthSimple(
      countryCode: "+91",
      phoneNumber: "9999999999",
      onVerificationSuccess: () {
        print("My Completed");
      },
      onVerificationFailure: () {
        print("My Failed");
      },
    );
  }
}

Example #

lib/home.dart #

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

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
    body:Center(
    child:Text("Home Page")
    )
    );
  }
}

lib/phone_number.dart #

import 'package:flutter/material.dart';
import 'package:phone_auth_simple/phone_auth_simple.dart';
import './get_otp.dart';


class PhoneNumber extends StatelessWidget {

  String phoneNumber;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: <Widget>[
          TextFormField(
            onSaved: (number)=>phoneNumber=number,
          ),
          FlatButton(
            child: Text("Get OTP"),
            onPressed: (){
              Navigator.pushReplacement(
                  context, MaterialPageRoute(builder: (context) => GetOtp(phoneNumber:phoneNumber)));
            },
          )
        ],
      ),
    );
  }
}

lib/get_otp.dart #

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

class GetOtp extends StatefulWidget {
  final String phoneNumber;
  GetOtp({this.phoneNumber});
  
  @override
  _GetOtpState createState() => _GetOtpState();
}

class _GetOtpState extends State<GetOtp> {
  @override
  Widget build(BuildContext context) {
    return PhoneAuthSimple(
      countryCode: "+91",
      phoneNumber: widget.phoneNumber,
      onVerificationSuccess: () {
        print("My Completed");
      },
      onVerificationFailure: () {
        print("My Failed");
      },
    );
  }
}

Params #

   PhoneAuthSimple(
   @required countryCode (String) 
   @required phoneNumber (String)
   @required onVerificationSuccess (VoidCallBack)
   @required onVerificationFailure (VoidCallBack)
    appBar (Widget)
    progressIndicatorColor (Color)
  )

Screenshot #

Screenshot 1 Screenshot 2

Upcoming Update #

New layout will be added. More Customization will be added

[0.0.1] - Release.

Integrated Firebase_auth Package

[0.0.2] -Release.

Added UI screen

[0.04] - Release

Auto OTP code retrieve

[0.0.5] - Release

Fixed Bug

[0.0.6] - Release

Improved functionality

[0.0.8] - Release

Added custom color of progress indicator

[0.0.9] - Release

Updated Documentation

Use this package as a library

1. Depend on it

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


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

We analyzed this package on Jul 15, 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

Fix lib/phone_auth_simple.dart. (-1.49 points)

Analysis of lib/phone_auth_simple.dart reported 3 hints:

line 6 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: PhoneAuthSimple.progressIndicatorColor, PhoneAuthSimple.appBar

line 61 col 3: The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

line 85 col 9: The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

Fix lib/src/phone_auth_otp.dart. (-0.50 points)

Analysis of lib/src/phone_auth_otp.dart reported 1 hint:

line 44 col 3: The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

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 (firebase_auth).

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

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

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
firebase_auth ^0.6.6 0.6.6 0.11.1+10
flutter 0.0.0
Transitive dependencies
collection 1.14.11
firebase_core 0.2.5+1 0.4.0+6
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test

Admin