otp_autofill_sms_consent 0.0.1 copy "otp_autofill_sms_consent: ^0.0.1" to clipboard
otp_autofill_sms_consent: ^0.0.1 copied to clipboard

PlatformAndroid

Updated Flutter plugin to extract OTP from SMS for verification using the SMS User Consent API in Android.

OTP autofill sms consent #

Updated Flutter plugin to extract OTP from SMS for verification using the SMS User Consent API in Android along with working patch for Android 13 and above

This plugin uses the SMS User Consent API

The following criteria must meet for the API to be triggered:

  • The message contains a 4-10 character alphanumeric string with at least one number.
  • The message was sent by a phone number that's not in the user's contacts.
  • If you specified the sender's phone number, the message was sent by that number.

Usage #

  _otpAutofillSmsConsent = OtpAutofillSmsConsent(
      pattern: r'\d{4,}',
      onAllowed: (sms) {
        _sms = sms;
        setState(() {});
      },
      onDenied: () {
        _scaffoldMessenger?.showSnackBar(
          const SnackBar(content: Text('User denied!')),
        );
      },
      onPatternUnmatched: () {
        _scaffoldMessenger?.showSnackBar(
          const SnackBar(
            content: Text('OTP not found! Please try entering OTP manually.'),
          ),
        );
      },
    )
      ..start('otpSender');

This plugin is extended version of another plugin created to fix the requirements of Android 13 and above.

1
likes
160
pub points
69%
popularity

Publisher

unverified uploader

Updated Flutter plugin to extract OTP from SMS for verification using the SMS User Consent API in Android.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on otp_autofill_sms_consent