Issue
here's a video which shows my problem.
https://drive.google.com/file/d/1YTnu1amCYhN9CGLygAyag-LhYMn3BDiO/view?usp=sharing
Thing is, I'm developing an app in flutter and have been debugging it for several months already in a real hardware (my own phone with android 11). Suddenly, today I have experienced this error. When I tap on a textfield or textformfield, the app crushes and restarts automatically. I've researched a couple forums which suggest:
But it doesn't work for me.
I've already been several hours trying to figure this out, rebooting my pc, my phone, trying an emulator, a friend's phone instead of mine, changing the properties of the textfields... But nothing seems to work. I've read that this problem happens randomly at some android 11 devices, but have seen no solution to it (I don't even know if there exists one).
About my code, it's as simple as this:
Flexible(
child: FractionallySizedBox(
widthFactor: 0.75,
heightFactor: 0.75,
alignment: Alignment.centerLeft,
child: TextFormField(
decoration: InputDecoration(
icon: Icon(Icons.person),
fillColor: Colors.white.withOpacity(0.80),
filled: true,
),
onChanged: (String v) => nombre = v,
textInputAction: TextInputAction.go,
),
),
),
My pubspec dependencies are:
firebase_core: ^1.17.1
firebase_auth: ^3.3.19
firebase_database: ^9.0.15
firebase_messaging: ^11.4.1
firebase_storage: ^10.2.17
event: ^2.0.5
mutex: ^3.0.0
chat_bubbles: ^1.3.0
clipboard: ^0.1.3
image_picker: ^0.8.5+3
shared_preferences: ^2.0.15
path_provider: ^2.0.11
xdg_directories: ^0.2.0
flutter_tts: ^3.4.0
google_speech: ^2.1.1
speech_to_text: ^5.6.0
record: ^4.1.1
gcloud: ^0.8.5
flutter_local_notifications: ^9.6.0
http: ^0.13.4
crypto: ^3.0.2
semaphore: ^0.2.1
audioplayers: ^1.0.0
spring_button: ^2.0.0
google_fonts: ^3.0.1
flutter_app_name: ^0.1.1
As I said, it has delivered no problems for the last months.
If anyone has an idea that may make it work again, I would be very grateful. And if want more data of my project, just ask for it. Thank you very much in advance.
Solution
Three weeks since this problem appeared, I have at last discovered where the error was all along. It seems I had a window in the Navigator pile that was a Stateless Widget instead of a Stateful Widget, and when that happens, every time a reload happens (hot reload, textfield tapping, launching the keyboard, etc), provokes that the application restarts. It seems logical, actually, but I didn't think about that window at all, so I just popped it from the Navigator as soon as I finished with it and everything went just fine.
Answered By - S_Rollan
Answer Checked By - Timothy Miller (JavaFixing Admin)