Repository navigation
Description
Calling TextEditingController.clear() does not call formatEditUpdate of TextInputFormatter's.
This makes it difficult to keep the formatter state in sync with TextEditingController.
Example case:
Some TextInputFormatter allows you to format the phone number in something like (555) 333-44-55, but it also has a method to get the phone in its original form without formatting like 555334455. There is also a field clear button that calls the method TextEditingController.clear(). When you click on this button, the text field will be erased, but this will not call the method formatEditUpdate, so it is still possible to get the value from the formatter.
There is a way out to force the programmer to also call some cleanup method on the formatter itself, but it is quite difficult to keep track of this.
Activity
TahaTesser commentedon Jul 14, 2021
Hi @siqwin
Thanks for filing the issue
Can you please provide a minimal code sample to demonstrate this and your
flutter doctor -vsiqwin commentedon Jul 14, 2021
Example:
Steps:
Flutter doctor
TahaTesser commentedon Jul 15, 2021
Hi @siqwin
Thanks for the details, I can confirm the issue
stablemasterCheck
flutter doctor -voutputs for each channel belowflutter doctor -v
✅ : No Issue ❌: Issue reproduced
tirth-patel-nc commentedon May 9, 2025
Triage Report
I was able to reproduce the issue using the provided code sample on both the
stable (3.29.3)andmaster (3.32.0-1.0.pre.474)channels.Code Sample (Same as OP)
Log After Typing `1`
Log Clicking Clear `X`
stable (3.29.3) - flutter doctor -v
master (3.32.0-1.0.pre.474) - flutter doctor -v
LongCatIsLooong commentedon Jul 7, 2026
I believe this is intended and documented (but only on
EditableText?). Formatters only runs on user input (e.g., via the onscreen keyboard or a physical keyboard), programmatical changes do not trigger the formatter. The behavior is a bit strange because theTextEditingController.clearcall can be triggered by a user input (e.g., clicking the "clear" button).binSaed commentedon Jul 28, 2026
I've opened a PR for this: #190166. It adds a note to
TextEditingController.clear()clarifying thatTextInputFormatters are not invoked on programmatic changes.Document that programmatic TextEditingController changes do not run i…
github-actions commentedon Sep 4, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.