Last updated:
0 purchases
phone verification
Phone Verification #
This package helps the flutter developer to send OTP to the user and verify user's Phone Number.
⭐It is recommended to use this package with real device and not emulator
⚠ Currently it only works on Android.
Features #
👉 Free OTP Verification System.
👉 Reliable
👉 4 digit OTP
Demo #
😅 I am hide my number due to privacy issue
Android #
Inside android/app/build.gradle file change following sdks
compileSdkVersion 31 //change to 31
defaultConfig {
--------------------------------------
--------------------------------------
minSdkVersion 21 //change to 21
targetSdkVersion 30 //change to 30
--------------------------------------
--------------------------------------
}
copied to clipboard
Inside android/app/src/main/AndroidManifest.xml add the following two lines
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mysql_register">
<!-- add these lines 👇 -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.SEND_SMS" />
<!-- add these lines 👆 -->
<application
copied to clipboard
Installation #
First, add the latest phone_verification package to your pubspec dependencies.
dependencies:
phone_verification: ^0.0.1
copied to clipboard
Second import package to your file
import 'package:phone_verification/phone_verification.dart'
copied to clipboard
Call the Instance of PhoneVerification class
PhoneVerification phoneverification = PhoneVerification(number: usernumber);
//here usernumber is the Phone number which is to be verified
copied to clipboard
Send OTP #
👉 In the following codes usernumber should be use without country code and Your Otp is the message I want to send with the OTP, you can change that according to your choice.
PhoneVerification phoneverification = PhoneVerification(number:'93514xxxxx' );
phoneverification.sendotp('Your Otp');
copied to clipboard
or
PhoneVerification(number: '93514xxxxx').sendotp('Your Otp');
copied to clipboard
Verify OTP #
👉 Pass the OTP entered by the user to verifyotp() method here enteredotpis the user typed OTP.
String check= 'No acion';
ElevatedButton(
onPressed: () async {
//write the below line to verify
bool verify = await PhoneVerification(number: '93514xxxxx').verifyotp(enteredotp.toString());
//if verified successfully it will return true else return false
if (verify == true) {
check = 'Verify';
}
else {
check = 'error';
}
},
child: Text("Tap To Verify")),
copied to clipboard
or
String check= 'No acion';
ElevatedButton(
onPressed: () async {
//write the below line to verify
PhoneVerification phoneverification = PhoneVerification(number: '93514xxxxx');
bool verify = await phoneverification.verifyotp(enteredotp.toString());
//if verified successfully it will return true else return false
check = verify == true ? 'verify' : 'error';
}
child: Text("Tap To Verify")),
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.