auto_sms_verification 0.0.6 copy "auto_sms_verification: ^0.0.6" to clipboard
auto_sms_verification: ^0.0.6 copied to clipboard

The Flutter package provides seamless integration of the SMS Retriever API for automatic SMS verification on the Android platform. This package allows your Android application to automatically read OT [...]

example/lib/main.dart

import 'dart:async';

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

void main() {
  runApp(MyApp());
}

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

class _MyAppState extends State<MyApp> {
  String _smsCode = "";

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

  @override
  void dispose() {
    AutoSmsVerification.stopListening();

    super.dispose();
  }

  Future<void> initPlatformState() async {
    var appSignature = await AutoSmsVerification.appSignature();
    print(['appSignature is ', appSignature]);
    var smsCode = await AutoSmsVerification.startListeningSms();
    setState(() {
      _smsCode = getCode(smsCode) ?? '';
    });
  }

  String? getCode(String? sms) {
    print("SMS: ${sms}");
    if (sms != null) {
      final intRegex = RegExp(r'\d+', multiLine: true);
      final code = intRegex.allMatches(sms).first.group(0);

      return code;
    }
    return null;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('SMS Code is: $_smsCode\n'),
        ),
      ),
    );
  }
}
9
likes
0
points
40
downloads

Publisher

unverified uploader

Weekly Downloads

The Flutter package provides seamless integration of the SMS Retriever API for automatic SMS verification on the Android platform. This package allows your Android application to automatically read OTPs (One-Time Passwords) without requiring manual user input, enhancing the user experience by streamlining the verification process. With this package, you can ensure secure and efficient OTP handling directly within your Flutter application.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on auto_sms_verification

Packages that implement auto_sms_verification