TextFormField spurious space insertion on cursor move, iOS only

I know from brainstorming with google search AI about this that it is a known issue. I have an idea for a workaround, but before I invest too much time into it, I wanted to inquire whether a fix is in the works in the flutter framework for iOS and I should simply live with this until the fix is released, or if someone already has a workaround readily available for use in application code.

What I ran into today is that if the user has Predictive Text or Auto-Correction enabled (either of them), cursor movement spuriously inserts spaces just before the cursor. I first noticed it dragging across some text as the cursor tracks my finger (actually mouse since I was using the iOS simulator). As I did that it was inserting spaces before the cursor as it went. So “aaaa” becomes “a a a a” as you drag across. It chops up any word. The easiest way to reproduce it is with a hardware keyboard, since exactly the same thing happens. Type aaaa then hit left arrow a few times and after each press, here is what happens, where | designates the cursor position, not an actual character:

0: aaaa|
1: aaaa| (first left arrow press, cursor didn’t move)
2: aaa|a (cursor moved, didn’t insert the spurious space yet)
3: aaa |a (cursor didn’t move, inserted spurious space)
4: aa |a a (cursor moved, and inserted spurious space)
5: aa| a a (cursor moved)

It seems like some sort of tug-of-war or race condition between flutter and the underlying system implementation, and the ways it can misbehave isn’t totally consistent, and it seems tied to the cursor.

So anyway I have a workaround in mind: track finger down in the widget, and if the finger is down obviously the space bar on the on-screen keyboard could not have been pressed so any space that appears must be spurious. That won’t work for a hardware keyboard obviously, but it’s a workaround for the most common usage.

Anyway this seems like something so glaring, that someone must have solved it already, so if I can not re-invent the wheel…