TextFields generate many warning/error messages in debug mode

While running in debug mode, tapping text fields in the gallery text fields demo (or any of the demos that feature text fields) produces loads of warning/error messages.
E/SpannableStringBuilder(  856): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(  856): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(  856): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(  856): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
W/IInputConnectionWrapper(  856): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(  856): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(  856): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(  856): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(  856): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(  856): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(  856): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(  856): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(  856): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(  856): endBatchEdit on inactive InputConnection

This issue was also noted here: https://github.com/flutter/flutter/issues/9221

Notes for the person who looks into this: tagged as Android-specific based on the logs and engine code that's doing the logging, though I haven't looked into whether the underlying issue triggering the logging is something in the framework.

This is still a bug, as of 10/25/2018.

Is this still happening for anybody? I think I haven't seen it in a while.

Is this still happening for anybody? I think I haven't seen it in a while.

Still have these error messages yes:
W/IInputConnectionWrapper(29232): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(29232): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(29232): getTextAfterCursor on inactive InputConnection

I just tried the gallery Cupertino textfield demo (just happened to try that first).  With very little effort I produced:
W/IInputConnectionWrapper(20059): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(20059): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(20059): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(20059): getCursorCapsMode on inactive InputConnection
W/IInputConnectionWrapper(20059): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(20059): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(20059): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(20059): getCursorCapsMode on inactive InputConnection

The messages appeared after entering a few characters in the initially focused textfield and then moving the focus to the textfield whose initial value was "Montreal Canada".

I did a little bit of digging. It looks like Android is generating these warnings because we are holding the InputConnection incorrectly in the Engine's TextInputPlugin. I haven't really figured out what we're doing wrong, though.

I did a little bit of digging. It looks like Android is generating these warnings because we are holding the InputConnection incorrectly in the Engine's TextInputPlugin. I haven't really figured out what we're doing wrong, though.

Any update? This bug is causing trouble for a barcode scanning app I'm writing designed for a bluetooth barcode scanner. I can't automatically submit without it submitting 6 times (or however many times the bug happens), regardless of flutter/dart logic, and regardless of whether the keyboard is visible or not. I have to manually select the submit button after every scan as a workaround.

From my understanding, this happens because you try to change the Textfield in the build method (or setState).
Here is the flutter document annotation for updating the text in a TexField

After calling this function, [text] will be the empty string and the selection will be invalid.
Calling this will notify all the listeners of this [TextEditingController] that they need to update (it calls [notifyListeners]). For this reason, this method should only be called between frames, e.g. in response to user actions, not during the build, layout, or paint phases

Based on that information I can only avoid the errors if I clear or update the text field on a didUpdateWidget or didChangeDependencies.
However, on the app I am working on there is no way to change the text field outside of the setState, so I don't see a way around these errors. Does anyone know if these are just warnings, or do they actually cause errors? Has anyone found a fix?

I can confirm, at least in my case when switching between different keyboard types (I'm switching from text to number, and vice versa). Each time I do that, I get these three warnings/errors while in debug mode.
W/IInputConnectionWrapper( 6807): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6807): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6807): getTextAfterCursor on inactive InputConnection

My code (located inside a build method):
    Widget roomTextField = CustomFormField(
      focusNode: roomTextFocus,
      controller: widget.roomTextCont,
      hintText: "Room",
      prefixIcon: Icons.location_on,
      keyboardType: TextInputType.text,
      suffix: IconButton(
        icon: Icon(Icons.keyboard,
            color: Theme.of(context).primaryIconTheme.color),
        splashColor: Colors.transparent,
        color: Colors.transparent,
        onPressed: () {
          setState(() {
            changeRoomFocus(context);
          });
        },
      ),
    );
    Widget roomNumberField = CustomFormField(
      focusNode: roomNumberFocus,
      controller: widget.roomNumCont,
      hintText: "Room",
      prefixIcon: Icons.location_on,
      keyboardType: TextInputType.number,
      suffix: IconButton(
        icon: Icon(Icons.keyboard,
            color: Theme.of(context).primaryIconTheme.color),
        splashColor: Colors.transparent,
        color: Colors.transparent,
        onPressed: () => setState(
          () => changeRoomFocus(context),
        ),
      ),
    );
    Widget buildStackedFields(BuildContext context) {
      return IndexedStack(
        index: roomFieldIndex,
        children: <Widget>[
          roomTextField,
          roomNumberField,
        ],
      );
    }

It seems to have something to do with the keyboard being open and the state of the widget itself.
All my code does is when the user presses a suffix icon inside a form field, it unfocuses that form field and focuses on another one using IndexStack. When I do that, I get the errors mentioned above.

This is still happening to me, any advice on how to get rid of the warnings? I have a single text field that has a suffix icon that I use to clear the text field (I tried both controller.clear and controller.text = "" I get the same warnings).
Here are the warnings that I get
W/IInputConnectionWrapper(21921): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper(21921): getSelectedText on inactive InputConnection W/IInputConnectionWrapper(21921): getTextAfterCursor on inactive InputConnection
And here is the simple textbox
    final searchField = TextField(       autofocus: false,       controller: searchFieldController,       textInputAction: TextInputAction.search,       onSubmitted: (val) {         viewModel.search(val);       },       decoration: InputDecoration(           suffixIcon: searchFieldController.text.isNotEmpty ? IconButton(               icon: Icon(Icons.clear),               onPressed: () => WidgetsBinding.instance                   .addPostFrameCallback((_) => searchFieldController.clear())) : null,           border: OutlineInputBorder(               borderRadius: BorderRadius.circular(32.0),               borderSide: BorderSide.none)),     );

This is still happening to me, any advice on how to get rid of the warnings? I have a single text field that has a suffix icon that I use to clear the text field (I tried both controller.clear and controller.text = "" I get the same warnings).
Here are the warnings that I get
W/IInputConnectionWrapper(21921): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper(21921): getSelectedText on inactive InputConnection W/IInputConnectionWrapper(21921): getTextAfterCursor on inactive InputConnection
And here is the simple textbox
final searchField = TextField(
      controller: searchFieldController,
      textInputAction: TextInputAction.search,
      onSubmitted: (val) {
        viewModel.search(val);
      },
      decoration: InputDecoration(
          suffixIcon: searchFieldController.text.isNotEmpty ? IconButton(
              icon: Icon(Icons.clear),
              onPressed: () => WidgetsBinding.instance
                  .addPostFrameCallback((_) => searchFieldController.clear())) : null,
    );

Apart from the warnings, do they actually impact anything negatively in the app?
Do I have to call the clear differently to get rid of them or something, or is this still an active bug?
Thanks

I did a little bit of digging. It looks like Android is generating these warnings because we are holding the InputConnection incorrectly in the Engine's TextInputPlugin. I haven't really figured out what we're doing wrong, though.

Hi goderbauer,
Do you still following this problem, it really generates many warnings to seriously affect the functionality of logs when debugging.
Many thanks

/cc @GaryQian who has been looking into loads of keyboard-related issues on Android and may have ideas.

hotfix version 7 never show this warning..
but after upgrade to hotfix version 8..
I keep getting 'getTextAfterCursor on inactive InputConnection' warning messages

warning still show when run demo code in here
[✓] Flutter (Channel dev, v1.15.3, on Mac OS X 10.15.2 19C57, locale
    en-US)
    • Flutter version 1.15.3 at /Users/tbm/dev/flutter_sdk/flutter
    • Framework revision 67826bdce5 (10 days ago), 2020-02-10 14:59:32
      -0800
    • Engine revision 6158f03ef5
    • Dart version 2.8.0 (build 2.8.0-dev.8.0 514a8d4c84)

Seems like this issue started for me after last upgrade. ver 8.
I have a form with multiple TextFormFields  with different keyboardTypes. Not sure where and how it all started but I know I wasn't seeing any of these errors before the upgrade.
I'm just concerned if this will cause build issues.  I'm assuming it will not because they are just warnings...

I am having the same problem on 1.12.13+hotfix8

I have the same problem to on 1.12.13+hotfix8 on multiple TextFormFields and it make the Navigator requestFocus after a push.

I have this issue with Flutter Version v1.12.13+hotfix.8. I think the update brought this error because the following code didn't work in Debugging mode too:
https://flutter.dev/docs/cookbook/forms/validation

I have the same problem on 1.12.13+hotfix8 on TextFormFields.

I have this issue with Flutter Version v1.12.13+hotfix.8. I think the update brought this error because the following code didn't work in Debugging mode too:
https://flutter.dev/docs/cookbook/forms/validation

Works for me with this configuration:

`Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel unknown, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.18362.720]
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Professional 2019 16.3.9)
[√] Android Studio (version 3.5)
[√] VS Code (version 1.43.1)
[√] Connected device (2 available)

• No issues found!`

I have almost the same problem on channel master v1.16.3. In my case the app crashes due to infinite warnings "getExtractedText on inactive InputConnection" after a one tap or couple of taps on the TextField. Even if Im not closing the keyboard programmatically. I think I tried everything but can't get it work.

Just tried new update from channel master, v1.16.4-pre.34.
Starting input: tba=com.ekey.resta ic=io.flutter.plugin.editing.InputConnectionAdaptor@d7bb8a2 mNaviBarColor -16777216 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager( 5669): startInputInner - Id : 0 I/InputMethodManager( 5669): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport( 5669): Input channel constructed: fd=99 D/InputTransport( 5669): Input channel destroyed: fd=102 D/InputMethodManager( 5669): prepareNavigationBarInfo() DecorView@318d93[MainActivity] D/InputMethodManager( 5669): getNavigationBarColor() -16777216 V/InputMethodManager( 5669): Starting input: tba=com.ekey.resta ic=io.flutter.plugin.editing.InputConnectionAdaptor@33044f0 mNaviBarColor -16777216 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager( 5669): startInputInner - Id : 0 I/InputMethodManager( 5669): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport( 5669): Input channel constructed: fd=102 D/InputTransport( 5669): Input channel destroyed: fd=99 D/InputMethodManager( 5669): prepareNavigationBarInfo() DecorView@318d93[MainActivity] D/InputMethodManager( 5669): getNavigationBarColor() -16777216 V/InputMethodManager( 5669): Starting input: tba=com.ekey.resta ic=io.flutter.plugin.editing.InputConnectionAdaptor@c00bcee mNaviBarColor -16777216 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager( 5669): startInputInner - Id : 0 I/InputMethodManager( 5669): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport( 5669): Input channel constructed: fd=99 D/InputTransport( 5669): Input channel destroyed: fd=102 D/InputMethodManager( 5669): prepareNavigationBarInfo() DecorView@318d93[MainActivity] D/InputMethodManager( 5669): getNavigationBarColor() -16777216
Good news , changing focus between TextFields is working as expected, but when Im taping the TextField twice it's gives infinite logs  and of course app is crashed.

Just tried new update from channel master, v1.16.4-pre.34.
Starting input: tba=com.ekey.resta ic=io.flutter.plugin.editing.InputConnectionAdaptor@d7bb8a2 mNaviBarColor -16777216 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager( 5669): startInputInner - Id : 0 I/InputMethodManager( 5669): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport( 5669): Input channel constructed: fd=99 D/InputTransport( 5669): Input channel destroyed: fd=102 D/InputMethodManager( 5669): prepareNavigationBarInfo() DecorView@318d93[MainActivity] D/InputMethodManager( 5669): getNavigationBarColor() -16777216 V/InputMethodManager( 5669): Starting input: tba=com.ekey.resta ic=io.flutter.plugin.editing.InputConnectionAdaptor@33044f0 mNaviBarColor -16777216 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager( 5669): startInputInner - Id : 0 I/InputMethodManager( 5669): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport( 5669): Input channel constructed: fd=102 D/InputTransport( 5669): Input channel destroyed: fd=99 D/InputMethodManager( 5669): prepareNavigationBarInfo() DecorView@318d93[MainActivity] D/InputMethodManager( 5669): getNavigationBarColor() -16777216 V/InputMethodManager( 5669): Starting input: tba=com.ekey.resta ic=io.flutter.plugin.editing.InputConnectionAdaptor@c00bcee mNaviBarColor -16777216 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager( 5669): startInputInner - Id : 0 I/InputMethodManager( 5669): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport( 5669): Input channel constructed: fd=99 D/InputTransport( 5669): Input channel destroyed: fd=102 D/InputMethodManager( 5669): prepareNavigationBarInfo() DecorView@318d93[MainActivity] D/InputMethodManager( 5669): getNavigationBarColor() -16777216
Good news , changing focus between TextFields is working as expected, but when Im taping the TextField twice it's gives infinite logs and of course app is crashed.

Same here

Sorry for delay answer guys, Im now on channel master v1.18.1-pre.20 and everything works

I get a similar warning when implementing a custom SearchDelegate.
This is my config:
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18363.720], locale de-DE)
    • Flutter version 1.12.13+hotfix.9 at C:\src\flutter
    • Framework revision f139b11009 (2 weeks ago), 2020-03-30 13:57:30 -0700
    • Engine revision af51afceb8
    • Dart version 2.7.2
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\tgrah\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.
[!] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.41.1)
    • VS Code at C:\Users\tgrah\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.8.1
[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

These are the warnings I get when the TextField (searchField) gets focus:
W/IInputConnectionWrapper(31570): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(31570): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(31570): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(31570): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(31570): endBatchEdit on inactive InputConnection

I get same problem too, i dont know what should i do
W/IInputConnectionWrapper( 2018): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper( 2018): getTextBeforeCursor on inactive InputConnection

I am having the same problem on 1.12.13+hotfix8 on multiple TextFormFields ， Android 10

I have same problem, will link my app issue to here.

I have some problem in Android. iOS works perfectly but android dont.... Please fix this.

I'm getting the same bug and logs. Can't remember anymore which beta version I was using that worked

W/IInputConnectionWrapper( 7660): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 7660): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 7660): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 7660): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 7660): endBatchEdit on inactive InputConnection

flutter doctor -v
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.4 19E287, locale en-GB)
    • Flutter version 1.17.1 at /Users/tahatesser/Code/flutter_stable
    • Framework revision f7a6a7906b (13 days ago), 2020-05-12 18:39:00 -0700
    • Engine revision 6bc433c6b6
    • Dart version 2.8.2

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/tahatesser/Code/SDK
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = /Users/tahatesser/Code/SDK
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.1

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build
      1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.45.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.10.2

[✓] Connected device (1 available)
    • SM M305F • 32003c30dc19668f • android-arm64 • Android 10 (API 29)

• No issues found!

Hello guys. This issue is causing a lot of problems for me. my users are unable to find search results due to the double character when typing space. When you type space in the textfield it is typed twice and effects the search results!. after that the user is not able to delete character. aand the shown error is
SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
Is there any temporary work around? It used to work fine in 1.12 version

@Aljabri-Salman - what you're describing sounds like a regression that's unrelated to this issue. Please create a new issue with a test case that demonstrates the problem and we'll look into it.

@HansMuller  This is the issue. It was closed. and referenced above due to dublicate:
56514

@Aljabri-Salman I've reopened #56514 56514

I've removed the regression label because, after over 3 years, it really (really) doesn't apply anymore.

I m facing the same problem. Is there any way to solve this??
I have tried to clear the controller. But Still, the warning occurs.
Flutter Version 1.19.0
W/IInputConnectionWrapper(11500): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(11500): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(11500): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(11500): endBatchEdit on inactive InputConnection

Same issue....
W/IInputConnectionWrapper(22959): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(22959): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(22959): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(22959): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(22959): endBatchEdit on inactive InputConnection
[✓] Flutter (Channel beta, 1.19.0-4.2.pre, on Mac OS X 10.15.5 19F101, locale en-IN)
• Flutter version 1.19.0-4.2.pre at /Users/baskar/Projects/flutter-sdk/flutter
• Framework revision 9b9b543d92 (5 days ago), 2020-06-22 12:19:28 -0700
• Engine revision 9a28c3bcf4
• Dart version 2.9.0 (build 2.9.0-14.1.beta)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/baskar/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
✗ CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293.
To re-install CocoaPods, run:
sudo gem install cocoapods
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.46.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.11.0
! Doctor found issues in 1 category.
Process finished with exit code 0

Same issue....
W/IInputConnectionWrapper(22959): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(22959): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(22959): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(22959): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(22959): endBatchEdit on inactive InputConnection
[✓] Flutter (Channel beta, 1.19.0-4.2.pre, on Mac OS X 10.15.5 19F101, locale en-IN)
• Flutter version 1.19.0-4.2.pre at /Users/baskar/Projects/flutter-sdk/flutter
• Framework revision 9b9b543 (5 days ago), 2020-06-22 12:19:28 -0700
• Engine revision 9a28c3bcf4
• Dart version 2.9.0 (build 2.9.0-14.1.beta)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/baskar/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
✗ CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods. For more info, see #14293.
To re-install CocoaPods, run:
sudo gem install cocoapods
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.46.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.11.0
! Doctor found issues in 1 category.
Process finished with exit code 0

Okay, I have solved this issue. in my case I had
final _scaffoldKey = GlobalKey<ScaffoldState>(); inside build method.
once I moved out from build, Things were good!

@

Okay, I have solved this issue.
in my case, by mistake I had...
final _scaffoldKey = GlobalKey<ScaffoldState>();  inside build method.
once I moved out from build to class property, Things were good!
Hope this may help some one.

Same issue....
W/IInputConnectionWrapper(22959): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(22959): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(22959): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(22959): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(22959): endBatchEdit on inactive InputConnection
[✓] Flutter (Channel beta, 1.19.0-4.2.pre, on Mac OS X 10.15.5 19F101, locale en-IN)
• Flutter version 1.19.0-4.2.pre at /Users/baskar/Projects/flutter-sdk/flutter
• Framework revision 9b9b543 (5 days ago), 2020-06-22 12:19:28 -0700
• Engine revision 9a28c3bcf4
• Dart version 2.9.0 (build 2.9.0-14.1.beta)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/baskar/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
✗ CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods. For more info, see #14293.
To re-install CocoaPods, run:
sudo gem install cocoapods
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.46.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.11.0
! Doctor found issues in 1 category.
Process finished with exit code 0

Nah.. this is not the solution.

This may be helpful to some...but I was running into this issue when I was trying to use the Provider package. I lifted my form state up i.e. all of the TextEditingControllers existed in a provider that would be Consumed by the various TextField/TextFormField widgets. By essentially "cloning" the controllers within the initState method for the various TextFields/TextFormFields like this:
@override   void initState() {     super.initState();     localController = Provider.of<AddBeerProvider>(context, listen: false).myProviderController;   }
  @override   Widget build(BuildContext context) {     return Consumer<AddBeerProvider>(builder: (context, model, child){       return TextFormField(         autocorrect: false,         keyboardType: TextInputType.number,         inputFormatters: <TextInputFormatter>[           WhitelistingTextInputFormatter.digitsOnly,           LengthLimitingTextInputFormatter(3)         ],         decoration: const InputDecoration(           labelText: 'IBU',           hintText: '30',         ),         controller: this.localController,       );     });   }
I was able to track the state within my Provider and not receive any warning messages. It could be my specific scenario, but I feel a lot of people are using a pattern similar to this.

I find this happens after I rename a class.
After renaming something sometimes an import statement will go all wonky.
For example:
I expect to see this:
import 'package:aerie/features/home/ui/views/output/output_list.dart';
But instead I get this:
import 'file:///D:/SourceCode/Flutter/aerie/lib/features/home/ui/views/output/output_list.dart';
Everything continues to run but then things get weird like the keyboard being dismissed for no reason.

Same issue on Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18363.959], locale en-US)

Same issue (Channel stasble, v1.20, on Microsoft Windows 10)

Same issue  (Channel stable, 1.20.1, on Linux, locale en_US.UTF-8)
Very easy to reproduce from the TextField class sample code. Run the sample and simply click the TextField. The Debug console immediately prints:
W/IInputConnectionWrapper(11942): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(11942): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(11942): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(11942): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(11942): endBatchEdit on inactive InputConnection

Am also getting this error from a form in showDialog widget. After popping the Showdialog the previous screen loads with the wrong data.
W/IInputConnectionWrapper(20652): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(20652): requestCursorAnchorInfo on inactive InputConnection
W/IInputConnectionWrapper(20652): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(20652): getTextBeforeCursor on inactive InputConnection

W/IInputConnectionWrapper(26584): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(26584): requestCursorAnchorInfo on inactive InputConnection
W/IInputConnectionWrapper(26584): getTextBeforeCursor on inactive InputConnection
I/flutter (26584):
W/IInputConnectionWrapper(26584): getTextBeforeCursor on inactive InputConnection
I/flutter (26584):
The  issue still persists in [√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.18363.1016], locale en-AU)

Okay, I have solved this issue.
in my case, by mistake I had...
final _scaffoldKey = GlobalKey<ScaffoldState>();  inside build method.
once I moved out from build to class property, Things were good!
Hope this may help some one.

Same issue....
W/IInputConnectionWrapper(22959): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(22959): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(22959): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(22959): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(22959): endBatchEdit on inactive InputConnection
[✓] Flutter (Channel beta, 1.19.0-4.2.pre, on Mac OS X 10.15.5 19F101, locale en-IN)
• Flutter version 1.19.0-4.2.pre at /Users/baskar/Projects/flutter-sdk/flutter
• Framework revision 9b9b543 (5 days ago), 2020-06-22 12:19:28 -0700
• Engine revision 9a28c3bcf4
• Dart version 2.9.0 (build 2.9.0-14.1.beta)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/baskar/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
✗ CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods. For more info, see #14293.
To re-install CocoaPods, run:
sudo gem install cocoapods
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.46.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.11.0
! Doctor found issues in 1 category.
Process finished with exit code 0

Thanks a lot, mate. This worked for me.

_searchTextFieldController.clear(); fixed the issue.
In my case, I had a text field to search with close on the suffix. So clicking the suffix was creating this issue, because I was trying to clear the text field by    _searchTextFieldController.text='', Now, instead I replaced the code with _searchTextFieldController.clear(); which fixed my issue.

I have very same problem when screen goes off.

My problem is that when I put a form for example directly in the main.dart it works correctly
but when I use the routers to navigate from page to another I cannot use the TextFormFields
flutter doctor -v
[√] Flutter (Channel stable, 1.20.4, on Microsoft Windows [version 10.0.19041.508], locale fr-FR)
    • Flutter version 1.20.4 at C:\flutter
    • Framework revision fba99f6cf9 (6 days ago), 2020-09-14 15:32:52 -0700
    • Engine revision d1bc06f032
    • Dart version 2.9.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at C:\Users\HAMZA TEK'NOLOGY IT\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 47.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] IntelliJ IDEA Ultimate Edition (version 2019.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.3
    • Flutter plugin version 43.0.2
    • Dart plugin version 192.8052

[√] VS Code (version 1.47.3)
    • VS Code at C:\Users\HAMZA TEK'NOLOGY IT\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.13.1

[√] Connected device (1 available)
    • JAT L29 (mobile) • 9EHNW20303000604 • android-arm • Android 9 (API 28)

• No issues found!

main.dart (the TextFormField Work)

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
    ]);
    return MaterialApp(
      title: 'YourCab Client',
      debugShowCheckedModeBanner: false,
      home: RegisterPage(),
      // ignore: missing_return

    );
  }
}

main.dart (the TextFormField dosn't Work)

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:yourcab_client/routes/routes.dart';
import 'package:yourcab_client/ui/register.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
    ]);
    return MaterialApp(
      title: 'YourCab Client',
      debugShowCheckedModeBanner: false,
      routes: routes,
      // ignore: missing_return

    );
  }
}

routes.dart

import 'package:flutter/cupertino.dart';
import 'package:yourcab_client/ui/about.dart';
import 'package:yourcab_client/ui/historique.dart';
import 'package:yourcab_client/ui/home.dart';
import 'package:yourcab_client/ui/login.dart';
import 'package:yourcab_client/ui/packs.dart';
import 'package:yourcab_client/ui/promotion.dart';
import 'package:yourcab_client/ui/register.dart';
import 'package:yourcab_client/ui/resetePassword.dart';
import 'package:yourcab_client/ui/setting.dart';
import 'package:yourcab_client/ui/splashScreen.dart';
import 'package:yourcab_client/ui/support.dart';

final routes = {
  '/register': (BuildContext context) => RegisterPage(),
};

Form

class RegisterPage extends StatefulWidget {
  @override
  _RegisterPageState createState() => _RegisterPageState();
}

class _RegisterPageState extends State<RegisterPage> {
  final _formRegisterKey = GlobalKey<FormState>();
  String _firstName, _lastName, _email, _telephone, _sexe, _password = "";
  @override
  Widget build(BuildContext context) {
    SizeConfig().init(context);
    return Scaffold(
      body: Container(
        height: SizeConfig.safeBlockVertical * 110,
        width: SizeConfig.safeBlockVertical * 100,
        child: ListView(
          padding: EdgeInsets.only(left: 20, right: 20),
          children: [
            Container(
              height: SizeConfig.safeBlockVertical * 15, //10 for example
              width: SizeConfig.safeBlockHorizontal * 20,
              margin: EdgeInsets.fromLTRB(50, 5, 50, 5),
              child: Image(
                alignment: Alignment.bottomCenter,
                image: AssetImage('assets/logo_bleu.png'),
              ),
            ),
            Form(
                key: _formRegisterKey,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      'Nom',
                      style: TextStyle(
                        textBaseline: TextBaseline.alphabetic,
                        fontWeight: FontWeight.w500,
                        fontSize: 20,
                        color: const Color(0xff454545),
                      ),
                      textAlign: TextAlign.start,
                    ),
                    SizedBox(
                      height: SizeConfig.blockSizeVertical * 1,
                    ),
                    TextFormField(
                      textInputAction: TextInputAction.next,
                      keyboardType: TextInputType.text,
                      onSaved: (login) => _firstName = login,
                      validator: (value) =>
                      value.isEmpty ? "Nom est obligatoire!" : null,
                      decoration: InputDecoration(
                        errorStyle: TextStyle(
                          color: Colors.red,
                          wordSpacing: 5.0,
                        ),
                        hintText: 'Nom',
                        border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(20),
                        ),
                        counter: Text(''),
                      ),
                      style: TextStyle(
                        fontSize: 20,
                        color: const Color(0xff454545),
                      ),
                    ),
                    Text(
                      'Prènom',
                      style: TextStyle(
                        textBaseline: TextBaseline.alphabetic,
                        fontWeight: FontWeight.w500,
                        fontSize: 20,
                        color: const Color(0xff454545),
                      ),
                      textAlign: TextAlign.start,
                    ),
                    SizedBox(
                      height: SizeConfig.blockSizeVertical * 1,
                    ),
                    TextFormField(
                      textInputAction: TextInputAction.next,
                      keyboardType: TextInputType.text,
                      onSaved: (login) => _lastName = login,
                      validator: (value) =>
                      value.isEmpty ? "Prènom est obligatoire!" : null,
                      decoration: InputDecoration(
                        errorStyle: TextStyle(
                          color: Colors.red,
                          wordSpacing: 5.0,
                        ),
                        hintText: 'Prènom',
                        border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(20),
                        ),
                        counter: Text(''),
                      ),
                      style: TextStyle(
                        fontSize: 20,
                        color: const Color(0xff454545),
                      ),
                    ),
                    Text(
                      'E-mail',
                      style: TextStyle(
                        textBaseline: TextBaseline.alphabetic,
                        fontWeight: FontWeight.w500,
                        fontSize: 20,
                        color: const Color(0xff454545),
                      ),
                      textAlign: TextAlign.start,
                    ),
                    SizedBox(
                      height: SizeConfig.blockSizeVertical * 1,
                    ),
                    TextFormField(
                      textInputAction: TextInputAction.next,
                      keyboardType: TextInputType.emailAddress,
                      onSaved: (email) => _email = email,
                      validator: (value) =>
                      value.isEmpty ? "E-mail est obligatoire!" : null,
                      decoration: InputDecoration(
                        errorStyle: TextStyle(
                          color: Colors.red,
                          wordSpacing: 5.0,
                        ),
                        hintText<EMAIL_ADDRESS>                        border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(20),
                        ),
                        counter: Text(''),
                      ),
                      style: TextStyle(
                        fontSize: 20,
                        color: const Color(0xff454545),
                      ),
                    ),
                    Text(
                      'Mobile',
                      style: TextStyle(
                        textBaseline: TextBaseline.alphabetic,
                        fontWeight: FontWeight.w500,
                        fontSize: 20,
                        color: const Color(0xff454545),
                      ),
                      textAlign: TextAlign.start,
                    ),
                    SizedBox(
                      height: SizeConfig.blockSizeVertical * 1,
                    ),
                    TextFormField(
                      textInputAction: TextInputAction.next,
                      keyboardType: TextInputType.emailAddress,
                      onSaved: (login) => _telephone = login,
                      validator: (value) =>
                      value.isEmpty ? "Mobile est obligatoire!" : null,
                      decoration: InputDecoration(
                        errorStyle: TextStyle(
                          color: Colors.red,
                          wordSpacing: 5.0,
                        ),
                        hintText: 'Numéro de Mobile'
                            '',
                        border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(20),
                        ),
                        counter: Text(''),
                      ),
                      style: TextStyle(
                        fontSize: 20,
                        color: const Color(0xff454545),
                      ),
                    ),
                    Text(
                      'Mot de Passe',
                      style: TextStyle(
                        textBaseline: TextBaseline.alphabetic,
                        fontWeight: FontWeight.w500,
                        fontSize: 20,
                        color: const Color(0xff454545),
                      ),
                      textAlign: TextAlign.start,
                    ),
                    SizedBox(
                      height: SizeConfig.blockSizeVertical * 1,
                    ),
                    TextFormField(
                      textInputAction: TextInputAction.done,
                      keyboardType: TextInputType.text,
                      obscureText: true,
                      onSaved: (password) => _password = password,
                      validator: (value) => value.isEmpty
                          ? "Mot de Passe est obligatoire!"
                          : null,
                      decoration: InputDecoration(
                        errorStyle: TextStyle(
                          color: Colors.red,
                          wordSpacing: 5.0,
                        ),
                        hintText: 'xxxxxxxxx',
                        border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(20),
                        ),
                        counter: Text(''),
                      ),
                      style: TextStyle(
                        fontSize: 20,
                        color: const Color(0xff454545),
                      ),
                    ),
                    Center(
                      child: RaisedButton(
                        shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(38.0),
                            side:
                            BorderSide(color: const Color(0xff203B7A))),
                        onPressed: () {
                          MaterialPageRoute(builder: (context)=>HomePage());
                          //print(_identifier);
                          if (_formRegisterKey.currentState.validate()) {
                            _formRegisterKey.currentState.save();
                            //signIn(_login, _password);
                            //saveUser(_login, _identifier);
                          }
                        },
                        color: const Color(0xff203B7A),
                        //padding: EdgeInsets.fromLTRB(135, 10, 100, 20),
                        child: Image(
                          height: 20,
                          image: const AssetImage('assets/arrow.png'),
                          fit: BoxFit.fitWidth,
                        ),
                      ),
                    ),
                  ],
                ))
            /*Padding(
                child: ,
                padding: EdgeInsets.all(10))*/
          ],
        ),
      ),
    );
  }
}

Hi, faced the same exact issue, did you resolve it?

@TahaTesser  any suggestion ???

Why??
1.22.0-12.0.pre
Google tech can't fix it?

W/IInputConnectionWrapper( 1673): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 1673): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 1673): getTextAfterCursor on inactive InputConnection

it happned 2017??? but not yet?

same issue in
Flutter 1.22.0-12.0.pre • channel unknown • unknown source
Framework • revision a27c242b0e (13 days ago) • 2020-09-11 17:46:57 -0400
Engine • revision fee6f9e533
Tools • Dart 2.10.0 (build 2.10.0-110.0.dev)

Android PIXEL 3a(it also google plroduct)
Google producst have a lot of bugs?

Have same issue here:
W/IInputConnectionWrapper( 6441): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 6441): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6441): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6441): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6441): endBatchEdit on inactive InputConnection

I hope we get
Android Security Rewards

same problem
Flutter 1.22.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f30b7f4db9 (2 days ago) • 2020-10-08 10:06:30 -0700
Engine • revision 75bef9f6c8
Tools • Dart 2.10.1

每次都弹出警告⚠好烦人。
W/IInputConnectionWrapper(32699): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(32699): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(32699): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(32699): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(32699): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(32699): getTextAfterCursor on inactive InputConnection

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.24.0-4.0.pre.32, on Mac OS X 10.15.7 19H2
    darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
[✓] Android Studio (version 3.6)
[✓] VS Code (version 1.50.1)
[✓] Connected device (2 available)

• No issues found!

Almost four years later, we still have the same problem.
W/IInputConnectionWrapper(27962): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(27962): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(27962): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(27962): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(27962): endBatchEdit on inactive InputConnection

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [versão 10.0.19041.630], locale pt-BR)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 4.1.0)
[√] VS Code (version 1.50.1)
[√] Connected device (1 available)

google neglected the bug yet?

@shinriyo No need to spam the thread. Just give it a thumbs up, I'm quite sure they are well aware of it.

@shinriyo No need to spam the thread. Just give it a thumbs up, I'm quite sure they are well aware of it.
Apart of that, this warning doesn't prevent the TextField from working.

It does Glitch sometimes and doesn't allow the user to input text.

Flutter 1.24.0-8.0.pre.149 • channel master • https://github.com/flutter/flutter.git
Framework • revision 8e7748e74c (4 weeks ago) • 2020-11-08 20:32:04 -0800
Engine • revision 0f7cdca65f
Tools • Dart 2.12.0 (build 2.12.0-27.0.dev)

same problem

I HATE THIS BUG
ic=io.flutter.plugin.editing.InputConnectionAdaptor@c02e797 mNaviBarColor -16777216 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager(20780): startInputInner - Id : 0
I/InputMethodManager(20780): startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport(20780): Input channel constructed: fd=92
D/InputTransport(20780): Input channel destroyed: fd=102
W/IInputConnectionWrapper(20780): getExtractedText on inactive InputConnection
flutter doctor -v
[✓] Flutter (Channel stable, 1.22.4, on Mac OS X 10.15.7 19H2 darwin-x64, locale zh-Hans)
• Flutter version 1.22.4 at /Users/virs/.fvm/versions/1.22.4-stable
• Framework revision 1aafb3a8b9 (4 周前), 2020-11-13 09:59:28 -0800
• Engine revision 2c956a31c0
• Dart version 2.10.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/virs/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = /Users/virs/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
• Xcode at /Applications/Xcode-beta.app/Contents/Developer
• Xcode 12.2, Build version 12B5044c
• CocoaPods version 1.9.1
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[!] IntelliJ IDEA Ultimate Edition (version 2019.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[✓] VS Code (version 1.51.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.17.0
[✓] Connected device (1 available)
• SM N9500 (mobile) • ce10171a3bade8f50c7e • android-arm64 • Android 9 (API 28)

@shinriyo Не нужно спамить ветку . Просто поднимите палец вверх, я совершенно уверен, что они это прекрасно понимают.
Кроме того, это предупреждение не мешает работе TextField.

Мне мешает работать! поле ввода прячется за клавиатуру

Repeat this problem by adding maxLength 1

Issue replicable with latest stable and master version.
Syncing files to device sdk gphone x86 arm...
W/IInputConnectionWrapper( 6784): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6784): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6784): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6784): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 6784): endBatchEdit on inactive InputConnection

stable and master flutter doctor -v
[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.4 19E2269 darwin-x64,
    locale en-IN)
    • Flutter version 1.22.5 at /Users/dhs/documents/Fluttersdk/flutter
    • Framework revision<PHONE_NUMBER> (7 days ago), 2020-12-10 11:54:40 -0800
    • Engine revision ae90085a84
    • Dart version 2.10.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /Users/dhs/Library/Android/sdk
    • Platform android-30, build-tools 30.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.51.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0

[✓] Connected device (1 available)
    • SM G975F (mobile) • RZ8M802WY0X • android-arm64 • Android 10 (API 29)

• No issues found!

[✓] Flutter (Channel master, 1.26.0-2.0.pre.64, on Mac OS X 10.15.4 19E2269
    darwin-x64, locale en-IN)
    • Flutter version 1.26.0-2.0.pre.64 at
      /Users/dhs/documents/Fluttersdk/flutter
    • Framework revision 9ff4326e1f (26 hours ago), 2020-12-17 06:19:05 +0000
    • Engine revision 6edb402ee4
    • Dart version 2.12.0 (build 2.12.0-157.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /Users/dhs/Library/Android/sdk
    • Platform android-30, build-tools 30.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.9.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.51.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0

[✓] Connected device (3 available)
    • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86    • Android 11
      (API 30) (emulator)
    • macOS (desktop)             • macos         • darwin-x64     • Mac OS X
      10.15.4 19E2269 darwin-x64
    • Chrome (web)                • chrome        • web-javascript • Google
      Chrome 87.0.4280.88

• No issues found!

code sample

return Scaffold(
      appBar: AppBar(),
      body: Center(
        child: TextField(
          decoration: InputDecoration(
            hintText: 'Enter here'
          ),
        )
      ),
    );

Issue still exists
W/IInputConnectionWrapper(17132): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(17132): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(17132): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(17132): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(17132): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(17132): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(17132): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(17132): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(17132): getTextAfterCursor on inactive InputConnection

So the issue was quite irritating but after some digging here and there I found out a simple working solution. Just check if you are using any "GlobalKey<......anythingState>" like this in the build method or not if yes then remove it from there and put it somewhere else. Then hot restart the app.
Hope this work for someone.

I have the same problem. I get the following errors:

W/IInputConnectionWrapper( 6371): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6371): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6371): getTextAfterCursor on inactive InputConnection

This error happens to me on Android 11 simulator (Android R - API level 30) only but not on any lower versions of android.
I have tried both master and stable channel, I tried moving GlobalKey around, I tried changing autofocus, initial value, onchanged, onsaved and ontap. Nothing seems to fix it. I am getting the initial value from shared preferences library and the error pops when I click on the textfield (when keyboard pops up).

 My TextFormFieldCode
class _CounterPageState extends State<CounterPage>
    with SingleTickerProviderStateMixin {
  final _formKey = GlobalKey<FormState>();
  TextEditingController amountController = TextEditingController();
        .....
        .....

GestureDetector(
                            onTap: () {
                              return showDialog(
                                context: context,
                                builder: (context) {
                                  return AlertDialog(
                                    content: Form(
                                      key: _formKey,
                                      child: Column(
                                        mainAxisSize: MainAxisSize.min,
                                        children: [
                                          TextFormField(
                                            autofocus: true,
                                            initialValue: store
                                                .normalUnitsUnloaded
                                                .toString(),
                                            onChanged: (newValue) {
                                              amountController.text =
                                                  newValue.toString();
                                            },
                                            onSaved: (_) {
                                              store.setNormalLineNumber(
                                                  int.parse(
                                                      amountController.text));
                                            },
                                            style: kTSAdjustable(context,
                                                FontStyle.normal, null, 0),
                                            cursorRadius: Radius.circular(2.0),
                                            cursorWidth: 8.0,
                                            keyboardType: TextInputType.number,
                                            validator: (input) {
                                              final isDigitsOnly =
                                                  int.tryParse(input);
                                              if (isDigitsOnly == null)
                                                return 'Please Enter Number';
                                              else if (isDigitsOnly < 0)
                                                return 'Number must be higher than 0';
                                              else
                                                return null;
                                            },
                                            decoration: InputDecoration(
                                              labelText: 'Units Unloaded',
                                              hintText:
                                                  "Enter Number of Units Unloaded",
                                            ),
                                          ),
                                          FlatButton(
                                            color: Colors.blue,
                                            onPressed: () {
                                              _formKey.currentState.save();

                                              Navigator.pop(context);
                                              amountController.clear();
                                              store.saveListsPrefs();
                                            },
                                            child: Text('Save'),
                                          ),
                                        ],
                                      ),
                                    ),
                                  );
                                },
                              );
                            },
                            child: Text(
                              "${store.normalUnitsUnloaded}",
                              style: kTSHeadline2(context),
                            ),
                          ),

flutter doctor -v

$ flutter doctor -v
[✓] Flutter (Channel stable, 1.22.5, on macOS 11.1 20C69 darwin-x64, locale en-AU)
• Flutter version 1.22.5 at /Users/fa/Developer/flutter
• Framework revision<PHONE_NUMBER> (4 weeks ago), 2020-12-10 11:54:40 -0800
• Engine revision ae90085a84
• Dart version 2.10.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/fa/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.10.0
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin installed
• Dart plugin version 201.9317
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio 2.app/Contents
• Flutter plugin installed
• Dart plugin version 201.9317
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.45.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.10.1
[✓] Connected device (1 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• No issues found!

I have the same problem. I get the following errors:

W/IInputConnectionWrapper( 6371): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6371): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6371): getTextAfterCursor on inactive InputConnection

This error happens to me on Android 11 simulator (Android R - API level 30) only but not on any lower versions of android.
I have tried both master and stable channel, I tried moving GlobalKey around, I tried changing autofocus, initial value, onchanged, onsaved and ontap. Nothing seems to fix it. I am getting the initial value from shared preferences library and the error pops when I click on the textfield (when keyboard pops up).

 My TextFormFieldCode
class _CounterPageState extends State<CounterPage>
    with SingleTickerProviderStateMixin {
  final _formKey = GlobalKey<FormState>();
  TextEditingController amountController = TextEditingController();
        .....
        .....

GestureDetector(
                            onTap: () {
                              return showDialog(
                                context: context,
                                builder: (context) {
                                  return AlertDialog(
                                    content: Form(
                                      key: _formKey,
                                      child: Column(
                                        mainAxisSize: MainAxisSize.min,
                                        children: [
                                          TextFormField(
                                            autofocus: true,
                                            initialValue: store
                                                .normalUnitsUnloaded
                                                .toString(),
                                            onChanged: (newValue) {
                                              amountController.text =
                                                  newValue.toString();
                                            },
                                            onSaved: (_) {
                                              store.setNormalLineNumber(
                                                  int.parse(
                                                      amountController.text));
                                            },
                                            style: kTSAdjustable(context,
                                                FontStyle.normal, null, 0),
                                            cursorRadius: Radius.circular(2.0),
                                            cursorWidth: 8.0,
                                            keyboardType: TextInputType.number,
                                            validator: (input) {
                                              final isDigitsOnly =
                                                  int.tryParse(input);
                                              if (isDigitsOnly == null)
                                                return 'Please Enter Number';
                                              else if (isDigitsOnly < 0)
                                                return 'Number must be higher than 0';
                                              else
                                                return null;
                                            },
                                            decoration: InputDecoration(
                                              labelText: 'Units Unloaded',
                                              hintText:
                                                  "Enter Number of Units Unloaded",
                                            ),
                                          ),
                                          FlatButton(
                                            color: Colors.blue,
                                            onPressed: () {
                                              _formKey.currentState.save();

                                              Navigator.pop(context);
                                              amountController.clear();
                                              store.saveListsPrefs();
                                            },
                                            child: Text('Save'),
                                          ),
                                        ],
                                      ),
                                    ),
                                  );
                                },
                              );
                            },
                            child: Text(
                              "${store.normalUnitsUnloaded}",
                              style: kTSHeadline2(context),
                            ),
                          ),

flutter doctor -v

$ flutter doctor -v
[✓] Flutter (Channel stable, 1.22.5, on macOS 11.1 20C69 darwin-x64, locale en-AU)
• Flutter version 1.22.5 at /Users/fa/Developer/flutter
• Framework revision<PHONE_NUMBER> (4 weeks ago), 2020-12-10 11:54:40 -0800
• Engine revision ae90085a84
• Dart version 2.10.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/fa/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.10.0
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin installed
• Dart plugin version 201.9317
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio 2.app/Contents
• Flutter plugin installed
• Dart plugin version 201.9317
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.45.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.10.1
[✓] Connected device (1 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• No issues found!

I have the same problem.
W/IInputConnectionWrapper(14685): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(14685): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(14685): endBatchEdit on inactive InputConnection

I have the same problem.
W/IInputConnectionWrapper(14685): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(14685): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(14685): endBatchEdit on inactive InputConnection

I think the issue was not solved yet. My problem is:
W/IInputConnectionWrapper( 3013): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 3013): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 3013): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 3013): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 3013): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 3013): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 3013): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 3013): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 3013): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 3013): endBatchEdit on inactive InputConnection

I think the issue was not solved yet. My problem is:
W/IInputConnectionWrapper( 3013): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 3013): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 3013): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 3013): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 3013): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 3013): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 3013): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 3013): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 3013): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 3013): endBatchEdit on inactive InputConnection

I am experiencing the same issue too.

I am experiencing the same issue too.

Please, let me know when this bug is fixed.

check this SO answer https://stackoverflow.com/a/63911657/10409567
TLDR
if you have UniqueKeys in your widget remove them.

This is causing crashes for me when compiled for release on Android on the current stable channel 1.22.6.
The second a user taps the input it crashes.
Any work arounds? It's a very straightforward widget. Just a TextField and a button to return the text as a route argument..

I have the exact same issue as @FlashChaser

This is causing crashes for me when compiled for release on Android on the current stable channel 1.22.6.
The second a user taps the input it crashes.
Any work arounds? It's a very straightforward widget. Just a TextField and a button to return the text as a route argument..
EDIT:
Setting autofocus to true fixes it for now...
EDIT 2:
Scratch that just causes app to crash instantly upon navigating to route. No debug errors though.
Is there another widget to capture text input that I can use? Or can I not use flutter until this is fixed?

@shinriyo No need to spam the thread. Just give it a thumbs up, I'm quite sure they are well aware of it.
Apart of that, this warning doesn't prevent the TextField from working.

but, it makes my status bar color red

May be the TextField element/widget is marked for rebuild or set state, then removed and a new one comes in but the focus is still on the one marked for rebuild?
For context started an app on the dev channel with firebase core 0.5.0 last year. A couple days ago I switched over everything to the 'null safety' firebase libraries and switched to the newest stable flutter version 2.0.3. I think I had the bachEdit errors back then, but now it seems to rebuild my entire material route tree. I tried Navigator.of(context).[pushName & push] and Navigator.push() and tried both with and without the schedulerbinding.instance.addPostFrameCallback method. I also tried to have them push either MaterialPageRoute or ModalRoute. I removed all keys, changed my app to try to not pass data with the offending classes (just a more isolated firebase bloc pattern for the classes). I tried changing 'controller:' and using a controller within onChange, i even removed the controller altogether. But it still seems to rebuild everything from the 'home:' of Material App when ever the TextField is selected.
In debugging (with Android studio) I set a break points all over (from main.dart to the TextField) and it seems that maybe when the TextField or TextFormField is clicked or focused on, it rebuilds or changes state but the focus continuously stays on it during the rebuild. I dont know enough about dirty elements/trees and rebuilds to really make a claim but:
may be the TextField element/widget is removed and a new one comes in but the focus is still on the one marked for rebuild? The error then comes in between the rebuild or new state of the textfeild? Maybe then the focus during the rebuild also causes a mark for rebuild during the rebuild/set state creating a loop that causes more issues?
Maybe a related issue, i started getting a new error 'setState() or markNeedsBuild() called during build.' in another area which i did not have before, I'll post some where else. But the issues may be related in a far back change in rebuild logic from a stable/dev channel in the past. But what do i know

Oddly enough I just installed the flutter demo from the google play store. It crashes for me as well when clicking on text input... not ideal.

That error will gone by remove " final formKey = GlobalKey();"
How can I do like this?

Is this never going to be solved, what's the point of having a whole develop framework that doesn't work with form fields? so many hours spent to develop a useless framework.

I'm with this problem. I can't use the addListener, but onChanged works normally.
W/TextInputPlugin(20229): Changing the content within the the composing region may cause the input method to behave strangely, and is therefore discouraged. See https://github.com/flutter/flutter/issues/78827 for more details
W/IInputConnectionWrapper(20229): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(20229): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(20229): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(20229): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(20229): endBatchEdit on inactive InputConnection

flutter doctor -v
[✓] Flutter (Channel stable, 2.2.1, on macOS 11.4 20F71 darwin-x64, locale en-BR)
    • Flutter version 2.2.1 at /Library/Developer/Flutter
    • Framework revision 02c026b03c (4 days ago), 2021-05-27 12:24:44 -0700
    • Engine revision 0fdb562ac8
    • Dart version 2.13.1

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/davidgaspardev/Library/Android/sdk
    • Platform android-30, build-tools 29.0.2
    • ANDROID_SDK_ROOT = /Users/davidgaspardev/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.10.1

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 51.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.56.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.22.0

[✓] Connected device (1 available)
    • moto e5 plus (mobile) • ZL5223RBBS • android-arm • Android 8.0.0 (API 26)

• No issues found!

Legit can't find the fix :(
please fix this TextField problem flutter team :'(

I am also facing the same problem. My issue is that this issue occurs only when I use the computer keyboard instead of the app keyboard. If I am using the app keyboard no issues, but it is really problematic to click each letter on the app board.
Although the app is not crashing it is annoying. Please fix this flutter team
W/IInputConnectionWrapper( 5277): getSelectedText on inactive InputConnection W/IInputConnectionWrapper( 5277): getTextAfterCursor on inactive InputConnection W/IInputConnectionWrapper( 5277): beginBatchEdit on inactive InputConnection W/IInputConnectionWrapper( 5277): endBatchEdit on inactive InputConnection

i am now facing some problem here. Here my error message :
W/IInputConnectionWrapper( 8528): beginBatchEdit on inactive InputConnection W/IInputConnectionWrapper( 8528): endBatchEdit on inactive InputConnection W/IInputConnectionWrapper( 8528): getSelectedText on inactive InputConnection

I am also facing the same problem. My issue is that this issue occurs only when I use the computer keyboard instead of the app keyboard. If I am using the app keyboard no issues, but it is really problematic to click each letter on the app board.
Although the app is not crashing it is annoying. Please fix this flutter team
W/IInputConnectionWrapper( 5277): getSelectedText on inactive InputConnection W/IInputConnectionWrapper( 5277): getTextAfterCursor on inactive InputConnection W/IInputConnectionWrapper( 5277): beginBatchEdit on inactive InputConnection W/IInputConnectionWrapper( 5277): endBatchEdit on inactive InputConnection

The problem continues. Computer Keyboard.

So okay I have found a solution for this in my use case.
My keyboard used to disappear as soon as it appeared on my screen. This not the bug in the framework, let us understand what happens in the background.
When the keyboard pops up, the screen needs to rebuild its components accordingly, so it forces a rebuild. Therefore the entire widgets are re-rendered including the TextFormField or TextField, which closes the Keyboard.
To solve this problem, we have to find a way to uniquely identify our widget which is rebuilding, and stop flutter from recreating that widget.
This can be done by using keys, first find the parent widget under which our TextFormField/TextField falls, and provide a unique key to it. Remember NOT to initialize the key on the key parameter of the widget. Instead declare it outside the build method and then use it. This makes sure that the unique does not change every time the build method is called.
I hope that this helps.
Thank You!

So okay I have found a solution for this in my use case.
My keyboard used to disappear as soon as it appeared on my screen. This not the bug in the framework, let us understand what happens in the background.
When the keyboard pops up, the screen needs to rebuild its components accordingly, so it forces a rebuild. Therefore the entire widgets are re-rendered including the TextFormField or TextField, which closes the Keyboard.
To solve this problem, we have to find a way to uniquely identify our widget which is rebuilding, and stop flutter from recreating that widget.
This can be done by using keys, first find the parent widget under which our TextFormField/TextField falls, and provide a unique key to it. Remember NOT to initialize the key on the key parameter of the widget. Instead declare it outside the build method and then use it. This makes sure that the unique does not change every time the build method is called.
I hope that this helps.
Thank You!

I actually did this. But I also had to replace TextField with TextFormField and set a key for that widget outside build and also its parent widget(like set the key of that stateless widget from its parent as an argument).
It worked, thanks!

So okay I have found a solution for this in my use case.
My keyboard used to disappear as soon as it appeared on my screen. This not the bug in the framework, let us understand what happens in the background.
When the keyboard pops up, the screen needs to rebuild its components accordingly, so it forces a rebuild. Therefore the entire widgets are re-rendered including the TextFormField or TextField, which closes the Keyboard.
To solve this problem, we have to find a way to uniquely identify our widget which is rebuilding, and stop flutter from recreating that widget.
This can be done by using keys, first find the parent widget under which our TextFormField/TextField falls, and provide a unique key to it. Remember NOT to initialize the key on the key parameter of the widget. Instead declare it outside the build method and then use it. This makes sure that the unique does not change every time the build method is called.
I hope that this helps.
Thank You!

I actually did this. But I also had to replace TextField with TextFormField and set a key for that widget outside build and also its parent widget(like set the key of that stateless widget from its parent as an argument).
It worked, thanks!

Most welcome! Yes, it's all about understanding how flutter works and then making the changes to your use cases accordingly!

I see this problem when using SearchDelegate and entering text using my physical keyboard with Vysor. Pressing the keyboard keys on screen or with the mouse on the mirrored keyboard on the computer works.
The problem is, that the input after the messages are shown gets completely stuck. No input neither with the physical nor virtual keyboard is possible until the screen is reloaded.
W/TextInputPlugin(14022): Changing the content within the the composing region may cause the input method to behave strangely, and is therefore discouraged. See https://github.com/flutter/flutter/issues/78827 for more details
W/ListenableEditingState(14022): a listener was added to EditingState while a batch edit was in progress
W/IInputConnectionWrapper(14022): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(14022): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(14022): endBatchEdit on inactive InputConnection

Example code
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: MyHomePage());
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: FloatingActionButton(
        onPressed: () => showSearch(context: context, delegate: MySearchDelegate()),
      ),
    );
  }
}

class MySearchDelegate extends SearchDelegate<void> {
  @override
  Widget buildLeading(BuildContext context) => Container();

  @override
  List<Widget> buildActions(BuildContext context) => [];

  @override
  Widget buildSuggestions(BuildContext context) => Container();

  @override
  Widget buildResults(BuildContext context) => Container();
}

Does this nightmare bug exist on Flutter 2.x ?
Does anybody check?

Does this nightmare bug exist on Flutter 2.x ?
Does anybody check?

Yes ! I can reproduce it on my Flutter 2 app :( :(

I have a TextFormField that emits this message when I type using my physical keyboard (emulator keyboard works fine). Bizarrely, if I set obscureText field to true, the issue goes away.

Yes, i'm having the same issue on Flutter 2.2.1

Does this nightmare bug exist on Flutter 2.x ?
Does anybody check?

Yes, i'm having the same issue on Flutter 2.2.1

Workaround for vscode users

My own solution is to write flutter in the field.

I'm having the same issue too 😢

It worked for me when i removed :
FocusScope.of(context).requestFocus(FocusNode()); ```

```dart
Column(
                  children: [
                    LabeledTextFormField(
                        controller: firstNameLastNameController,
                        hintText: "Nom et prenom*",
                        enabled: true,
                        title: "",
                        onChanged: (value) {}),
                    LabeledTextFormField(
                        controller: emailAddressController,
                        hintText: "Addresse e-mail",
                        enabled: true,
                        title: "",
                        onChanged: (value) {}),
                    LabeledTextFormField(
                        controller: phoneNumberController,
                        title: "",
                        enabled: true,
                        keyboardType: TextInputType.phone,
                        hintText: "Numero de telephone*",
                        onChanged: (value) {}),
                    Padding(
                      padding: EdgeInsets.only(left: 20, right: 20, top: 20),
                      child: CustomButton(
                        titleColor: kColorPrimary,
                        title: "S'inscrire",
                        onPressed: () {
                          FocusScope.of(context).requestFocus(FocusNode());  // <----- I just removed this
                        },
                      ),
                    )
                  ],
                ) ```

Only solution I managed to find was moving TextField to a StatelessWidget:
class CreateNewRoutineDialog extends StatelessWidget {
  CreateNewRoutineDialog();

  final TextEditingController textEditingController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Material(
      child: TextField(
        controller: textEditingController,
        autofocus: true,
      ),
    );
  }
}

Any possible variation of implementing this in a StatefullWidget produced the errors described by others:
class CreateNewRoutineDialog extends StatefulWidget {

  final TextEditingController textEditingController = TextEditingController();

  final Key txtKey = Key("1234");
  // final Key txtKey = GlobalKey();
  // final Key txtKey = UniqueKey();

  CreateNewRoutineDialog();

  @override
  _CreateNewRoutineDialogState createState() => _CreateNewRoutineDialogState();
}

class _CreateNewRoutineDialogState extends State<CreateNewRoutineDialog> {

  @override
  Widget build(BuildContext context) {
    return Material(
      child: TextField(
        key: widget.txtKey,
        controller: widget.textEditingController,
        autofocus: true,
      ),
    );
  }
}

I've tried assigning keys to the TextField, parent widget, storing Key/TextEditingController in both, state and the widget but none worked.
I've read most of the comments above and documentation but I still fail to understand why this doesn't work in the StatefullWidget. Would someone be able to explain what is the issue in the above StatefullWidet please?

I have the same issue but It only happens when I type with my keyboard, if I use the emulator's keyboard it works fine

I've same issue but when i disabled the onChanged property of TextField it works fine.

This error/warning persists on Flutter 2.2.3, any solution?

If this bug persists only on debug mode, then there wouldn't be any problem when the app is in release profile. Worrying about it is of no use, since emulators cannot be compared to actual devices in any way possible.

I have the same issue but It only happens when I type with my keyboard, if I use the emulator's keyboard it works fine

same issue

For anyone having this same problem, this solved it for me:
WidgetsBinding.instance.addPostFrameCallback((_) => _textFieldController.clear());
From:
StackOverflow: Unhandled Exception: PlatformException(error, invalid selection start: 24, null, java.lang.IndexOutOfBoundsException: invalid selection start: 24

This has always plagued me, and unfortunately, I've come to get used to it since I like having a more responsive emulator;  but if you change your emulator graphics from Hardware to Software it prevents the log spam (for me at least).

This is still a thing as of 08/08/21.

Same here whenever i click on any of the textField in the app am getting this
W/IInputConnectionWrapper(20969): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(20969): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(20969): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(20969): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(20969): endBatchEdit on inactive InputConnection

Still an issue as of 09/10/2021. Still figuring out what's actually wrong. Please look into it flutter team.

This happens on both emulator and real phone.
environment:
sdk: ">=2.12.0 <3.0.0"

9/15/2021
same here
still no fix yet :(
come on flutter team you can at less push this fix with the next patch 💯

I've same issue but when i disabled the onChanged property of TextField it works fine.

Can someone with the same situation correct me? Are you assigning the text controller within the onChanged() method? Like this:
onChanged(String newValue) {
textController.text = newValue;
}
If so, can you remove the assignment and determine if the problem is fixed?
Text assignment is unnecessary. My problem fixed like that.

Do you think this issue can cause accessibility issues?
TalkBack(Android screen reader) does not announce the character to edit when move the cursor.

Anyone knows how to fix the example code:
https://flutter.dev/docs/cookbook/forms/validation
and want to share it?

The problem is caused by the android emulator. This issue only occurs when typing from the computer keyboard.

The problem is caused by the android emulator. This issue only occurs when typing from the computer keyboard.

This is not the case for many of us

We have a typical login page with two text fields (username/password).  So this is the first page we hit for every single one of our Integration Tests.  So in the output for every single test we see:

Absolutely infuriating as this is polluting the logs making it hard to pick out test results (not to mention Integration Test reporting  doesn't work for Flutter).

this is still happening to me and i did every change that stackoverflow has told me but no use if anyone finds answer tell me i am really depressed from past two days because of this

Running into this issue
W/IInputConnectionWrapper(18998): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(18998): requestCursorAnchorInfo on inactive InputConnection
W/IInputConnectionWrapper(18998): getTextBeforeCursor on inactive InputConnection
D/InputConnectionAdaptor(18998): The input method toggled cursor monitoring on

Hard to tell what's causing it, but in my case is triggered working with Focus class

I have the same issue but It only happens when I type with my keyboard, if I use the emulator's keyboard it works fine

same problem here

I also have the same problem... Anytime the TextField or TextFormField is active (or has focus), this error or bug or whatever prints in the debug console until the particular widget's scope is inactive.
I'm using flutter version 2.8.0 stable release
This is the sample code:

class SearchScreen extends StatefulWidget {
  const SearchScreen({Key key}) : super(key: key);

  @override
  _SearchScreenState createState() => _SearchScreenState();
}

class _SearchScreenState extends State<SearchScreen> {
  final Database _database = Database();
  final TextEditingController searchUsernameController =
      TextEditingController();

  Widget searchTile({
    String userName,
    String userEmail,
    BuildContext context,
  }) {
    return Container(
      padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
      child: Row(
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                userName,
                style: const TextStyle(overflow: TextOverflow.ellipsis),
              ),
              addVertical(6.5),
              SizedBox(
                width: 250,
                child: Text(
                  userEmail,
                  style: const TextStyle(overflow: TextOverflow.ellipsis),
                ),
              ),
            ],
          ),
          const Spacer(),
          ElevatedButton(
            onPressed: () {
              createChatRoom(userName: userName);
            },
            child: const Text("Message"),
            style: ElevatedButton.styleFrom(
              padding: const EdgeInsets.symmetric(
                horizontal: 16.0,
                vertical: 8.0,
              ),
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(25),
              ),
              primary: Colors.blue,
            ),
          ),
        ],
      ),
    );
  }

  @override
  void initState() {
    super.initState();
    initiateSearch();
    searchUsernameController.addListener(() {
      final String message = searchUsernameController.text;
      searchUsernameController.value = searchUsernameController.value.copyWith(
        text: message,
        selection: TextSelection(
          baseOffset: message.length,
          extentOffset: message.length,
        ),
        composing: TextRange.empty,
      );
    });
  }

  @override
  void dispose() {
    searchUsernameController.dispose();
    initiateSearch();
    super.dispose();
  }

  QuerySnapshot searchSnapshot;

  initiateSearch() {
    _database
        .getUsersByUsername(searchUsernameController.text)
        .then((val) => {searchSnapshot = val});
  }

  createChatRoom({String userName}) {
    Future<dynamic> otherUser = HelperFunctions.getUserName();
    if (userName != otherUser) {
      String chatRoomID = getChatRoomId(userName, otherUser);
      List<dynamic> users = [userName, otherUser];

      Map<String, dynamic> chatRoomMap = {
        "users": users,
        "chatRoomID": chatRoomID,
      };
      _database.createChatRoom(chatRoomID, chatRoomMap);
      Navigator.push(
        context,
        MaterialPageRoute(
          builder: (context) => ChatDetail(
            userName: userName,
          ),
        ),
      );
    } else {
      return null;
    }
  }

  Widget searchList() {
    return searchSnapshot != null
        ? ListView.builder(
            itemCount: searchSnapshot.docChanges.length,
            shrinkWrap: true,
            itemBuilder: (BuildContext context, int index) {
              return searchTile(
                userEmail: searchSnapshot.docs[index].get("email"),
                userName: searchSnapshot.docs[index].get("name"),
              );
            },
          )
        : Container(
            child: const Center(
                child: Text("No result...", style: TextStyle(color: black))));
  }

  @override
  Widget build(BuildContext context) {
    final ThemeData themeData = Theme.of(context);
    return Scaffold(
      appBar: AppBar(
        elevation: 0.0,
        centerTitle: true,
        leading: IconButton(
          onPressed: () async {
            Navigator.pop(context);
          },
          icon: const Icon(
            Icons.arrow_back_ios_outlined,
            size: 23,
            color: Colors.white,
          ),
        ),
        actions: [
          IconButton(
            icon: const Icon(Icons.wb_sunny_rounded),
            onPressed: () {},
          ),
        ],
        title: Text(
          "Search...",
          style: GoogleFonts.lato(
              fontSize: 20, fontWeight: FontWeight.w600, color: Colors.white),
        ),
      ),
      body: Column(
        children: [
          Expanded(
            child: Container(
              decoration: BoxDecoration(
                color: white.withAlpha(150),
              ),
              child: SingleChildScrollView(
                child: Column(
                  mainAxisSize: MainAxisSize.max,
                  children: [
                    ClipRRect(
                      child: SizedBox(
                        child: Padding(
                          padding: const EdgeInsets.symmetric(
                            horizontal: 9,
                            // vertical: 10,
                          ),
                          child: Container(
                            height: 44,
                            margin: const EdgeInsets.all(9),
                            padding: const EdgeInsets.only(left: 5),
                            decoration: const BoxDecoration(
                              borderRadius: BorderRadius.all(
                                Radius.circular(10.0),
                              ), // set rounded corner radius
                            ),
                            child: Center(
                              child: TextField(
                                controller: searchUsernameController,
                                onChanged: (val) {
                                  setState(() {
                                    searchUsernameController.text = val;
                                    if (kDebugMode) {
                                      print(val);
                                    }
                                  });
                                },
                                style: const TextStyle(color: Colors.black54),
                                decoration: InputDecoration(
                                  enabledBorder: OutlineInputBorder(
                                    borderRadius: BorderRadius.circular(10),
                                    borderSide: const BorderSide(
                                        color: Colors.black87, width: 0.0),
                                  ),
                                  focusedBorder: const OutlineInputBorder(
                                    borderRadius:
                                        BorderRadius.all(Radius.circular(10)),
                                    borderSide: BorderSide(
                                        color: Colors.blueAccent, width: 0.7),
                                  ),
                                  hintText: 'Search Username...',
                                  hintStyle: const TextStyle(
                                      fontSize: 17, color: Colors.black54),
                                  suffixIcon: IconButton(
                                    onPressed: () {
                                      initiateSearch();
                                    },
                                    icon: const Icon(Icons.search),
                                  ),
                                ),
                              ),
                            ),
                          ),
                        ),
                      ),
                    ),
                    searchList(),
                  ],
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}

Any particular reason why this problem persists?

I have the same issue but It only happens when I type with my keyboard, if I use the emulator's keyboard it works fine

same problem here

For me, whether I use the keyboard or the emulator's keyboard, the value is still the same!

same problem, only in android

Same problem, and my users are complaining about the keyboard error -- this seems to be not just an emulator only problem.

Hello guys, had the same issue and solved it, but in my case it was a bit more related to BLoC rebuilding the TextField than to the TextField itself. The issue also haven't affected the field visually much: incorrect cursor position and micro-stutter when the messages drop to console.
So, I had the BlocBuilder with a buildWhen set up. In the build I had the TextField and some simple logic that changed controller's initial value depending on the state. Really simple, something like this:
buildWhen: (previous, current) => previous.runtimeType != current.runtimeType,
builder: (context, state) {
  if (state is ReadSuccessExampleStorageState) _controller.text = state.value;
  if (state is ErrorExampleStorageState) _controller.text = state.error;
  if (state is DeleteSuccessExampleStorageState) _controller.text = 'value deleted';

  return CustomTextFormField(
  ...

I didn't use listener at first since builder should not have any undesired builds in this particular case. After some investigations I found out that build actually WAS happening when unfocused field being tapped. I guess that happened because MediaQuery/Scaffold rebuilt on keyboard opening and invoked didChangeDependencies somewhere, since the buildWhen wasn't triggered during that parasitic build at all.
Reworked it using BlocConsumer's listener, now the errors/warnings do not appear anymore.
Probably something like this could be reproduced with other state management or even with vanilla setState.
Hope my comment will help someone. This issue is pretty unobvious.
Btw this comment should not be treated as a solution - it's dealing with the consequence, not with the cause. Some undesired controller.text assignments should not be breaking the controller/textField like this.

Still seems to be an issue; March 5 2022 - Flutter 2.10.2
On testing with code from the Material Components Basics - 101 demo, I observe the following behavior on Android emulator:
Switching Focus
When tapping on a TextField to focus and start typing and

Both Username and Password fields are empty, when switching from/to either field:
I/AssistStructure( 5007): Flattened final assist data: 404 bytes, containing 1 windows, 3 views

Username field has content and Password field is empty:

Shifting focus from username field to password field by tapping:
W/IInputConnectionWrapper( 5007): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5007): getTextAfterCursor on inactive InputConnection
Shifting focus from password field to username field by tapping:
I/AssistStructure( 5007): Flattened final assist data: 404 bytes, containing 1 windows, 3 views

Username field is empty and password field has content:

Shifting focus from username field to password field by tapping:
I/AssistStructure( 5007): Flattened final assist data: 404 bytes, containing 1 windows, 3 views
Shifting focus from password field to username field by tapping:
 E/SpannableStringBuilder( 5007): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
sometimes followed by:
I/AssistStructure( 5007): Flattened final assist data: 400 bytes, containing 1 windows, 3 views

Both Username and password fields have some text:

Shifting focus from username field to password field by tapping:
W/IInputConnectionWrapper( 5007): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5007): getTextAfterCursor on inactive InputConnection
Shifting focus from password field to username field by tapping:
I/AssistStructure( 5007): Flattened final assist data: 404 bytes, containing 1 windows, 3 views

Typing
Using the emulator's keyboard seems to not give warnings when typing in either the Username or Password fields, atleast in my case.
However on each character typed (or deleted) using my PCs physical keyboard, in the Username field, the following warnings show up:
I/TextInputPlugin( 5007): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5007): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5007): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5007): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5007): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5007): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5007): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5007): endBatchEdit on inactive InputConnection
`
Using the Physical keyboard to type in the password field does not generate any warnings
Submitting
Pressing submit after typing in the Username field generates the following errors for both emulator keyboard and physical keyboard:
I/TextInputPlugin( 5007): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5007): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5007): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5007): getTextAfterCursor on inactive InputConnection
`
No warnings are thrown on doing the same with the Password field.
Appendix
The code defining the Username and Password fields:
const TextField(             decoration: InputDecoration(               filled: true,               labelText: 'Username',             ),           ),
const TextField(             decoration: InputDecoration(               filled: true,               labelText: 'Password',             ),             obscureText: true,           ),
I couldn't arrive at a solution or identify the cause.
I'm not sure if any of this is consequential, but it's more data and could be helpful.
More power to the Flutter Team! Hope this gets fixed soon!

final GlobalKey _formKey = GlobalKey();
make the globalkey varaible before
@override
Widget build(BuildContext context)

Just wanted to say happy 5th anniversary to the issue. Year 2022 Flutter 3, issue still persists. When you type in a textfield from computer keyboard, have we already given up on this or we are calling it a value added feature not an issue?
During todays inflation and high cost of electricity typing one character throwing this many logs is not sustainable:

I/TextInputPlugin( 5178): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5178): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5178): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5178): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5178): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5178): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5178): endBatchEdit on inactive InputConnection

This is just a piece of disgusting i came her 6 months before i had the same error now i cam 6 months after i again had same issue so did anyone find the answer i have tried everything

Still seems to be an issue; March 5 2022 - Flutter 2.10.2 On testing with code from the Material Components Basics - 101 demo, I observe the following behavior on Android emulator:
Switching Focus
When tapping on a TextField to focus and start typing and

Both Username and Password fields are empty, when switching from/to either field:
I/AssistStructure( 5007): Flattened final assist data: 404 bytes, containing 1 windows, 3 views

Username field has content and Password field is empty:

Shifting focus from username field to password field by tapping:
W/IInputConnectionWrapper( 5007): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5007): getTextAfterCursor on inactive InputConnection
Shifting focus from password field to username field by tapping:
I/AssistStructure( 5007): Flattened final assist data: 404 bytes, containing 1 windows, 3 views

Username field is empty and password field has content:

Shifting focus from username field to password field by tapping:
I/AssistStructure( 5007): Flattened final assist data: 404 bytes, containing 1 windows, 3 views
Shifting focus from password field to username field by tapping:
 E/SpannableStringBuilder( 5007): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
sometimes followed by:
I/AssistStructure( 5007): Flattened final assist data: 400 bytes, containing 1 windows, 3 views

Both Username and password fields have some text:

Shifting focus from username field to password field by tapping:
W/IInputConnectionWrapper( 5007): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5007): getTextAfterCursor on inactive InputConnection
Shifting focus from password field to username field by tapping:
I/AssistStructure( 5007): Flattened final assist data: 404 bytes, containing 1 windows, 3 views

Typing
Using the emulator's keyboard seems to not give warnings when typing in either the Username or Password fields, atleast in my case.
However on each character typed (or deleted) using my PCs physical keyboard, in the Username field, the following warnings show up:
I/TextInputPlugin( 5007): Composing region changed by the framework. Restarting the input method. W/IInputConnectionWrapper( 5007): getTextAfterCursor on inactive InputConnection W/IInputConnectionWrapper( 5007): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper( 5007): getSelectedText on inactive InputConnection W/IInputConnectionWrapper( 5007): getTextAfterCursor on inactive InputConnection W/IInputConnectionWrapper( 5007): beginBatchEdit on inactive InputConnection W/IInputConnectionWrapper( 5007): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper( 5007): endBatchEdit on inactive InputConnection `
Using the Physical keyboard to type in the password field does not generate any warnings
Submitting
Pressing submit after typing in the Username field generates the following errors for both emulator keyboard and physical keyboard EDIT: 'Pressing submit' meaning the submit button on the emulator keyboard or the 'Enter' key on PC's physical keyboard:
I/TextInputPlugin( 5007): Composing region changed by the framework. Restarting the input method. W/IInputConnectionWrapper( 5007): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper( 5007): getSelectedText on inactive InputConnection W/IInputConnectionWrapper( 5007): getTextAfterCursor on inactive InputConnection ` No warnings are thrown on doing the same with the Password field.
Appendix
The code defining the Username and Password fields: const TextField( decoration: InputDecoration( filled: true, labelText: 'Username', ), ), const TextField( decoration: InputDecoration( filled: true, labelText: 'Password', ), obscureText: true, ),
I couldn't arrive at a solution or identify the cause. I'm not sure if any of this is consequential, but it's more data and could be helpful. More power to the Flutter Team! Hope this gets fixed soon!
i did that adding const but it did not work

For anyone having this same problem, this solved it for me:
WidgetsBinding.instance.addPostFrameCallback((_) => _textFieldController.clear());
From: StackOverflow: Unhandled Exception: PlatformException(error, invalid selection start: 24, null, java.lang.IndexOutOfBoundsException: invalid selection start: 24

can you please eloborate i did not understand YA THANKYOU!

same problem. I´m using bloc, but an old version

I'm new to developing mobile apps with Flutter. After creating my app, I can't save data with the app. Only in backend.
When I save the data, this is the output from my debug console:
W/IInputConnectionWrapper(25576): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(25576): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(25576): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(25576): getTextBeforeCursor on inactive InputConnection
Here the codes of application:
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
void main() => runApp(const MyApp());
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State createState() => _MyAppState();
}
class _MyAppState extends State {
TextEditingController name = TextEditingController();
TextEditingController email = TextEditingController();
TextEditingController password = TextEditingController();
Future insertrecord() async {
if (name.text != "" || email.text != "" || password.text != "") {
try {
String uri = "http://<IP_ADDRESS>./pratice_api/insert_record.php";
    var res = await http.post(Uri.parse(uri), body: {
      "name": name.text,
      "email": email.text,
      "password": password.text
    });
    var response = jsonDecode(res.body);
    if (response["succes"] == "true") {
      print("ajout reussi !");
      name.text = "";
      email.text = "";
      password.text = "";
    } else {
      print("aucune donnee disponible");
    }
  } catch (e) {
    print(e);
  }
} else {
  print("un champ obligatoire omis");
}

}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner:
false, //Pour enlever l'icône de debug flutter automatique
home: Scaffold(
appBar: AppBar(
title: const Text('Insert Record'),
),
body: Column(
children: [
Container(
margin: EdgeInsets.all(10),
child: TextFormField(
controller: name,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text('Inter your name')),
),
),
Container(
margin: EdgeInsets.all(10),
child: TextFormField(
controller: email,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text('Inter your Email')),
),
),
Container(
margin: EdgeInsets.all(10),
child: TextFormField(
controller: password,
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text('Inter your password')),
),
),
Container(
margin: EdgeInsets.all(10),
child: ElevatedButton(
onPressed: () {
insertrecord();
},
child: Text('Envoyer'),
),
),
Container(
margin: EdgeInsets.all(10),
child: Builder(
builder: (context) {
return ElevatedButton(
onPressed: () {}, child: Text("View data"));
},
),
),
],
),
),
);
}
}

Still facing this issue, when I'm selecting an option from drop down list or switching from TextFormField, it will caused this error. It's a problem because sometimes it won't update my bloc change value. Any idea on this?

This is my solution.
https://github.com/siqwin/mask_text_input_formatter/issues/64#issuecomment-1327205058

Still facing this issue, when I'm selecting an option from drop down list or switching from TextFormField, it will caused this error. It's a problem because sometimes it won't update my bloc change value. Any idea on this?

I'm facing the issue while entering data in TextFormField, but not when selecting entries from a DropdownButtonFormField, are you sure about that? 👀

keyboardType: TextInputType.visiblePassword solves problems with changing the keyboard type (generally speaking, the logs will also become cleaner, but I didn’t care about them)

I checked this on two Android devices (Realme 6, Android 11, Galaxy Tab A7 Lite (Android 14)) but couldn't see the warning/error as reported. I'm on the latest Flutter stable 3.19.5.

flutter doctor -v (stable and master)
[✓] Flutter (Channel stable, 3.19.5, on macOS 14.1 23B74 darwin-x64, locale en-VN)
    • Flutter version 3.19.5 on channel stable at /Users/huynq/Documents/GitHub/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 300451adae (8 days ago), 2024-03-27 21:54:07 -0500
    • Engine revision e76c956498
    • Dart version 3.3.3
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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
    • android-studio-dir = /Applications/Android Studio.app/
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.87.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.84.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 14.1 23B74 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 123.0.6312.106

[✓] Network resources
    • All expected network resources are available.

• No issues found!

[!] Flutter (Channel master, 3.22.0-11.0.pre.14, on macOS 14.1 23B74 darwin-x64, locale en-VN)
    • Flutter version 3.22.0-11.0.pre.14 on channel master at /Users/huynq/Documents/GitHub/flutter_master
    ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 817630ccf1 (51 minutes ago), 2024-04-15 22:56:25 -0400
    • Engine revision 76fbe31a96
    • Dart version 3.5.0 (build 3.5.0-61.0.dev)
    • DevTools version 2.35.0-dev.8
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode15.3.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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
    • android-studio-dir = /Applications/Android Studio.app/
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.88.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.86.0

[✓] Connected device (4 available)
    • RMX2001 (mobile) • EUYTFEUSQSRGDA6D                         • android-arm64  • Android 11 (API 30)
    • iPhone (mobile)  • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios            • iOS 15.8 19H370
    • macOS (desktop)  • macos                                    • darwin-x64     • macOS 14.1 23B74 darwin-x64
    • Chrome (web)     • chrome                                   • web-javascript • Google Chrome 123.0.6312.124

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

This is my solution.
siqwin/mask_text_input_formatter#64 (comment)

seems the keyboard auto-correction make the logs prints. but now sure is it an issue.
it stop print out when I disable the emulator's Gboard auto-correction.