flutter_flow_chart
flutter_flow_chart copied to clipboard
Text Editor Bug/Crash
Hello Marco,
We notice when using your flutter_flow_chart, that when attempting to input text into an object, the editor quickly closes (before we can input any text), due to the following exception (see below):
Note: The exception below can cause the flutter app (consisting solely of your code example) to crash (please see attached video Bug-Crash.mp4 for more information).
https://user-images.githubusercontent.com/33987270/203934265-b4b59bc5-0f3d-44b7-bb6a-35f1156af026.mp4
`======== Exception caught by scheduler library ============================================== The following assertion was thrown during a scheduler callback: Cannot get renderObject of inactive element.
In order for an element to have a valid renderObject, it must be active, which means it is part of the tree.
Instead, this element is in the _ElementLifecycle.defunct state.
If you called this method from a State object, consider guarding it with State.mounted.
The findRenderObject() method was called for the following element: StatefulElement#6d185(DEFUNCT)
no widget
When the exception was thrown, this was the stack:
#0 Element.findRenderObject.
Thank you for any help you can provide.
Hi,
thanks for your helpful video!! Seems like the problem comes from StarMenu package! Since I wrote that package I can do something I hope! In the week end I'll look into that.
Hello Marco,
Thank you for all your help.
posted a fix for the bounty, hope it helps.
Hi @gitgudyyao , it's always a good practice to check the mounted state! :) I have merged your PR, seems to fix the problem. For now should be better to manage the text change without using the StarMenu. Anyway, I still need to check the StarMenu package because the main problem comes from that with this issue. Thank you
Hello @alnitak ,
Apologies for not responding sooner.
I believe you are correct, StarMenu is still leading to problems.
I just updated all my Flutter packages (picked up the new update), and though I don't see the same exception, I still see the same behavior (i.e., the keyboard window closes before I can type anything).
For now, the current exception is the following:
======== Exception caught by scheduler library ===================================================== E/flutter (31108): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter/src/widgets/overlay.dart': Failed assertion: line 161 pos 12: '_overlay != null': is not true. E/flutter (31108): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61) E/flutter (31108): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5) The following assertion was thrown during a scheduler callback: Cannot get renderObject of inactive element. E/flutter (31108): #2 OverlayEntry.remove (package:flutter/src/widgets/overlay.dart:161:12)
Thank you for all your help.