Menu

Why does iOS SMS AutoFill add extra digits to a verification code in Flutter?
📰

Why does iOS SMS AutoFill add extra digits to a verification code in Flutter?

DEV Community: ios·zheng li·1 day ago
#644DJPNa
#devtoios#devto#dev#issuecomment#flutter
Long article (831 words) — no AI summary yet.
Reading 0:00
15s threshold

Title

Has anyone using your Flutter app reported that they tapped the SMS code above the iPhone keyboard and got more digits than were in the message?

On our login screen, tapping 123456 gave me 12345612 . Where did that last 12 come from? I logged the value inside Flutter’s native iOS input view and found 123456123456 . Our field had an eight-character limit, so only the first two digits of the second copy were visible. In a field without a length limit, you can see the entire code twice.

What happened on one tap?

I reproduced it on an iPhone 17 running iOS 27.2 RC with Flutter 3.35.7. Tapping a real SMS suggestion triggered three callbacks:

setMarkedText:selectedRange: wrote 123456 into the field.

unmarkText committed it. The field now contained the full code, with the cursor at the end.

UIKit delivered 123456 again. That version of FlutterTextInputView had no setText: method, so UIKit called insertText: and appended the code at the cursor.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.