otp_consent 2.0.0-nullsafety.1 copy "otp_consent: ^2.0.0-nullsafety.1" to clipboard
otp_consent: ^2.0.0-nullsafety.1 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 'package:flutter/material.dart';
import 'package:otp_consent/otp_consent.dart';

void main() => runApp(MaterialApp(home: MyApp(),));

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

class _MyAppState extends State<MyApp> with OtpConsentAutoFill {
  String? otp;

  @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();
                  },
                ),
                Text(otp ?? ""),
              ],
            ),
          ),
        ),
      ),
    );
  }

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

  @override
  void smsReceived(String? sms) {
    setState(() {
      otp = sms;
    });
  }

}
1
likes
0
pub points
39%
popularity

Publisher

verified publisherhuynn109.me

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

unknown (LICENSE)

Dependencies

flutter, test

More

Packages that depend on otp_consent