otp_consent 1.0.3 copy "otp_consent: ^1.0.3" to clipboard
otp_consent: ^1.0.3 copied to clipboard

outdated

Flutter plugin to provide SMS User Consent API gives the content of a single SMS message to us if the user gives permission.

example/lib/main.dart

import 'dart:async';
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:otp_consent/otp_consent.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with OtpConsentAutoFill {
  var otpConsent = OtpConsent();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin otp consent example app'),
        ),
        body: Container(
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              mainAxisSize: MainAxisSize.max,
              children: <Widget>[
                MaterialButton(
                  color: Colors.red,
                  textColor: Colors.white,
                  child: Text('Start Listening'),
                  onPressed: () async {
                    startOtpConsent(senderPhoneNumber: "0909999999");
                  },
                )
              ],
            ),
          ),
        ),
      ),
    );
  }

  @override
  void smsReceived(String sms) {
    log('smsReceived $sms');
    log('parsed ${this.sms}');
  }

  @override
  void dispose() {
    stopOtpConsent();
    super.dispose();
  }
}
1
likes
40
points
4
downloads

Publisher

verified publisherhuynn109.me

Weekly Downloads

Flutter plugin to provide SMS User Consent API gives the content of a single SMS message to us if the user gives permission.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on otp_consent

Packages that implement otp_consent