flutter_otp
OTP को भेजने और सत्यापित करने के लिए एक Flutter पैकेज। चार अंकों का OTP (कस्टमाइज़ किया जा सकता है) दिए गए फ़ोन नंबर (और देश कोड) पर SMS के रूप में भेजा जाता है।
एक फ्लटर पैकेज जो iOS और Android के लिए है, जिसका उपयोग फ़ोन नंबर पर OTP भेजने और सत्यापित करने के लिए किया जाता है।
{"sdk":"flutter"}^0.2.4{"sdk":"flutter"}यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
Awesome Flutter contributions welcome Known Vulnerabilities Build Status
A Flutter package for Android and iOS for sending and verifying OTP to a Phone number.
Now you can send the message to any country code passed as a parameter to the interface (sendOtp() function)
Add this to your package's pubspec.yaml file:
dependencies:
flutter_otp: ^0.3.2
You can install packages from the command line: with Flutter:
$ flutter packages get
Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:flutter_otp/flutter_otp.dart';
The important functions used in the package are :
void sendOtp(String phoneNumber, [String messageText]) {
...
}
NOTE:
- 10 digit phoneNumber should be passed.
- parameter "messageText" is optional. By default the message text is "Your OTP is : XXXX". If "messageText" parameter is passed then message is sent as " XXXX".
bool resultChecker(int enteredOtp) {
...
}
NOTE: The OTP entered by user (say, through TextField widget or TextFormField widget etc) is to be passed as a parameter to this function.
To use this package in your application you need to have a sim card in your mobile.
Example Usage:
...
sendOtp('958347XXXX'); //Pass phone number as String
...
int enteredOtp;
TextField(
onChanged: (val) {
enteredOtp = val;
}
)
...
bool isCorrectOTP = resultChecker();
if(isCorrectOTP) {
print('Success');
} else {
print('Failure');
}
...
OR custom "messageText" can be passed as parameter to sendOTP
...
sendOtp('958347XXXX', 'OTP is : '); //Pass phone number and Custom messaseText as String
...
int enteredOtp;
TextField(
onChanged: (val) {
enteredOtp = val;
}
)
...
bool isCorrectOTP = resultChecker();
if(isCorrectOTP) {
print('Success');
} else {
print('Failure');
}
...
:star: the repo to show support!