PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Written By
Views

AUTO READ SMS | FLUTTER

AUTO READ SMS | FLUTTER

Hello Guys, in this post we will cover how to read SMS OTP automatically. In Every mobile application there is mobile number verification feature will be available. To Verify the Mobile Numbers by sending the SMS OTP to registered mobile numbers.

When user receives the OTP he has to copy and paste the code will get irritate by users. To avoid this apps will try to read received SMS OTP and fill the TestFields automatically. To do auto read SMS OTP we have a library plugin called sms_autofill



The AUTO Fill widget will be used to read the SMS
PinFieldAutoFill(
  decoration: UnderlineDecoration(
    textStyle: TextStyle(fontSize: 20, color: Colors.black),
    colorBuilder: FixedColorBuilder(Colors.black.withOpacity(0.3)),
  ),
 codeLength: 4,
  onCodeSubmitted: (code) {},
  onCodeChanged: (code) {
    if (code.length == 6) {
      FocusScope.of(context).requestFocus(FocusNode());
    }
  },
)

Listen OTP Events To listen the SMS events we need to call SMS Listener on initState() method


```java _listOPT() async { await SmsAutoFill().listenForCode; } ```

SMS FORMAT The SMS should be the below format

<#> SampleApp: Your verification code is 1435
Z66b5+ou+DI

auto-sms-otp.jpg

Read and run the complete Example code

Comments (0)

loading comments