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

Libraries

phone_auth_simple

Dart

dart:ui
Built-in types and core primitives for a Flutter application. [...]

Core

dart:async
Support for asynchronous programming, with classes such as Future and Stream. [...]
dart:collection
Classes and utilities that supplement the collection support in dart:core. [...]
dart:convert
Encoders and decoders for converting between different data representations, including JSON and UTF-8. [...]
dart:core
Built-in types, collections, and other core functionality for every Dart program. [...]
dart:developer
Interact with developer tools such as the debugger and inspector. [...]
dart:math
Mathematical constants and functions, plus a random number generator. [...]
dart:typed_data
Lists that efficiently handle fixed sized data (for example, unsigned 8 byte integers) and SIMD numeric types. [...]

VM

dart:io
File, socket, HTTP, and other I/O support for non-web applications. [...]
dart:isolate
Concurrent programming using isolates: independent workers that are similar to threads but don't share memory, communicating only via messages. [...]