Last updated:
0 purchases
releans verify
releans_verify #
In this plugin, you can send and verify OTP through releans API
import #
import 'package:releans_verify/releans.dart';
copied to clipboard
init releans #
copy API key from releans dashboard and set the apiKey
create sender from releans dashboard and set the sender
set resending delay in seconds, default delay is 15 seconds
void main() async {
ReleansVerify().init(
apiKey: "XXXXXXXXXXXXXXXXX",
sender: "XXXXXXXXX",
resendingDelayInSeconds: 30
);
runApp(MyApp());
}
copied to clipboard
send OTP #
call sendCode with mobile number
mobile number should contain the country code
specify channel (default is sms)
ReleansResult result =
await ReleansVerify().sendCode(mobile: "+9715200000");
ReleansResult result = await ReleansVerify()
.sendCode(mobile:"+9715200000",channel: Channel.voice);
copied to clipboard
listen to remaining count down time #
listen to ReleansVerify().remainingSeconds for showing remaining seconds
if you want to cancel timer manually call disposeTimer()
ValueListenableBuilder<int>(
valueListenable: ReleansVerify().remainingSeconds,
builder: (context, value, _) {
return Text("resend after $value sec");
}),
ReleansVerify().disposeTimer();
copied to clipboard
verify OTP #
call verifyCode with user entered code and mobile number
ReleansResult result = await ReleansVerify().verifyCode(
code: "0000", mobile:"+9715200000");
copied to clipboard
handle result #
ReleansResult object will return after sendCode and verifyCode methods
view response message by using reult.message
check request is success by using result.isSuccess()
//print message
log("message ${result.message}");
//print status code
log("status ${result.status}");
//check request is success
log("isSuccess ${result.isSuccess()}");
copied to clipboard
Authors #
Yjoz General Trading L.L.C
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.