releans_verify 1.0.4 copy "releans_verify: ^1.0.4" to clipboard
releans_verify: ^1.0.4 copied to clipboard

PlatformAndroidiOS
outdated

by using this plugin you can simply send and verify OTP using the releans API

releans_verify #

In this plugin, you can send and verify OTP through releans API

import #

import 'package:releans_verify/releans.dart';

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());
}

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);

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();

verify OTP #

  • call verifyCode with user entered code and mobile number
 ReleansResult result = await ReleansVerify().verifyCode(
                          code: "0000", mobile:"+9715200000");

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()}");

Authors #

2
likes
130
points
3
downloads

Publisher

verified publisheryjoz.com

Weekly Downloads

by using this plugin you can simply send and verify OTP using the releans API

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dio, flutter, plugin_platform_interface

More

Packages that depend on releans_verify

Packages that implement releans_verify