question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CodeAutoFill mixin issue while listening for code

See original GitHub issue

There is a issue in the CodeAutoFill mixin. The docs says:

listenForCode() to listen for the SMS code from the native plugin when SMS is received, need to be called on your initState.

but after some tests it seems that this is not enough. If you just do this code will not get detected. In order to start listening for the OTP you need to call both in the initState:

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

If you do not call SmsAutoFill().listenForCode; after listenForCode() you will never receive the OTP code in the Flutter app.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
rfitz123commented, Apr 1, 2020

@pedromassango I’m also trying to use the mixin and haven’t gotten it to catch the code yet. I use with CodeAutoFill, call listenForCode() and SmsAutoFill().listenForCode in initState like above, I implement codeUpdated(). codeUpdated() called twice in a row about one minute after receiving the text, but code was null. Did you have any other difficulties that might account for this? Really hard to debug this 😕

1reaction
jaumardcommented, Apr 1, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Flutter Plugin to Provide OTP Code Autofill Support - Morioh
Flutter plugin to provide SMS code autoDetect support. Package which will help you to generate pin code fields. Can be useful for OTP...
Read more >
Enhance SMS-delivered code security with domain-bound ...
Many websites and apps offer additional login security in the form of SMS-delivered codes. On iPhone, Security Code AutoFill makes it easy ...
Read more >
Flutter Mixins and Base Classes: A recipe for success
What if Mike is a coder and we want a code function that can be used in other class, but is notused by...
Read more >
Inheritance with Mixin in Flutter | by Anmol Gupta - FlutterDevs
Mixins are really great in dart as they provide us flexibility for code reusability. mixins are normal classes whose method can be used...
Read more >
Blog - Archive - 2019 - Michael Tsai
... 2019 (1)December 19, 2019; How Clean Re-installs Change in Catalina December 19, 2019 ... 2019; Mixing License Codes and the Mac App...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found