sms_consent_for_otp_autofill

Creator: coderz1093

Last updated:

Add to Cart

Description:

sms consent for otp autofill

sms_consent_for_otp_autofill #
Flutter plugin for otp auto fill, used SMS Consent API to retrieve the otp of a single SMS message if the user gives permission.No permission required in manifest. For Android, that's where this package is useful. No need for iOS, using Android's SMS User Consent API
Screenshots #





Steps to use #
1] Create an instance, optionally supply phone number listener and sms listener
import 'package:sms_consent_for_otp_autofill/sms_consent_for_otp_autofill.dart';

SmsConsentForOtpAutofill smsConsentForOtpAutoFill = SmsConsentForOtpAutofill(
// optionally, do something when user selects a number.
// You can even add/update this listener later on by simply
// calling smsUserConsent.updatePhoneNumberListener(updatedListener)
phoneNumberListener: (number) {},

// optionally, do something when user receives sms.
// You can even add/update this listener later on by simply
// calling smsUserConsent.updateSmsListener(updatedListener)
smsListener: (otpcode) {}
);
copied to clipboard
2a] OPTIONAL : Request user's phone number
smsConsentForOtpAutoFill.requestPhoneNumber();
copied to clipboard
Once the user selects a phone number, it can be accessed as
smsConsentForOtpAutoFill.selectedPhoneNumber;
copied to clipboard
2b] OPTIONAL : Request to receive SMS
smsConsentForOtpAutoFill.requestSms();
copied to clipboard
or you can specify the phone number you wish to capture the SMS from
smsConsentForOtpAutoFill.requestSms(senderPhoneNumber: sender_number);
copied to clipboard
Once the user receives a SMS and the user taps Allow, it can be accessed as
smsConsentForOtpAutoFill.receivedSms;
copied to clipboard
3] Finally, dispose the instance
smsConsentForOtpAutoFill.dispose();
copied to clipboard
Note #
As per the SMS User Consent API, otp will be received by the plugin only if it meets these criteria:

The message contains 6-10 numbers.
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.

Contributing #

Found a bug or idea to improve the plugin? Send a PR.
my portfolio Portfolio
Want to hire me for a gig? Let's talk on LinkedIn

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.