You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Calling TextEditingController.clear() does not call formatEditUpdate of formatter #86354
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.
Calling TextEditingController.clear() does not call formatEditUpdate of TextInputFormatter's.
This makes it difficult to keep the formatter state in sync with TextEditingController.
Can you please provide a minimal code sample to demonstrate this and your flutter doctor -v
Hi @siqwin
Thanks for the details, I can confirm the issue
stable
master
❌
❌
Check flutter doctor -v outputs for each channel below
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.22000.65], locale en-US) • Flutter version 2.2.3 at C:\Users\Taha\Code\flutter_stable • Framework revision f4abaa0735 (2 weeks ago), 2021-07-01 12:46:11 -0700 • Engine revision 241c87ad80 • Dart version 2.13.4[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\Taha\Code\android-sdk • Platform android-30, build-tools 30.0.3 • ANDROID_SDK_ROOT = C:\Users\Taha\Code\android-sdk • Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174) • All Android licenses accepted.[✓] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.10.3) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.10.31424.327 • Windows 10 SDK version 10.0.19041.0[!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).[✓] VS Code (version 1.58.1) • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.24.0[✓] Connected device (4 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.65] • Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.124 • Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.67! Doctor found issues in 1 category.
[✓] Flutter (Channel master, 2.4.0-5.0.pre.55, on Microsoft Windows [Version 10.0.22000.65], locale en-US) • Flutter version 2.4.0-5.0.pre.55 at C:\Users\Taha\Code\flutter_master • Upstream repository https://github.com/flutter/flutter.git • Framework revision b549e829e8 (9 hours ago), 2021-07-14 15:51:10 -0700 • Engine revision 093c4ed1a3 • Dart version 2.14.0 (build 2.14.0-312.0.dev)[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\Taha\Code\android-sdk • Platform android-30, build-tools 30.0.3 • ANDROID_SDK_ROOT = C:\Users\Taha\Code\android-sdk • Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174) • All Android licenses accepted.[✓] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.10.3) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.10.31424.327 • Windows 10 SDK version 10.0.19041.0[✓] Android Studio (version 4.2.0) • Android Studio at C:\Users\Taha\Code\android-studio • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)[✓] VS Code (version 1.58.1) • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.24.0[✓] Connected device (5 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.65] • Windows (UWP) (desktop) • winuwp • windows-uwp-x64 • • Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.124 • Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.67• No issues found!
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 the TextEditingController.clear call can be triggered by a user input (e.g., clicking the "clear" button).
I've opened a PR for this: #190166. It adds a note to TextEditingController.clear() clarifying that TextInputFormatters are not invoked on programmatic changes.
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 -v and a minimal reproduction of the issue.
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.