Accessing FormBuilderState currentState value within dispose
#1260
Unanswered
judsonjames
asked this question in
Q&A
Replies: 1 comment
-
Hi, sorry for delay response |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using Flutter Form Builder in order to collect data, then save to my database using Isar. When a user pops the widget either with the OS dependent "back button" or the "back button" on the AppBar, I want to store the state of the Form to a draft value. However, also I'm utilizing GoRouter, which doesn't work with
WillPopScope
. It works fine on my desktop emulator, but on a native Android device it will fail to pop the widget with either back button. So, given a Widget that looks like this:I can't get the form value because the widget has already popped from the tree and doesn't exist. I can't use the
willPopScope
property ofFormBuilder
because it conflicts withGoRouter
. I've tried usingrouterDelegate
to get the data, but it gives inconsistent results from FormState depending on what fields were populated.I've considered using
Provider
to cache the data of the Form from theonChanged
callback onFormBuilder
but I think that's overkill and could be a performance hit. Are there any other alternatives native to FlutterFormBuilder that allow the FormState to be accessed before the widget is popped?Beta Was this translation helpful? Give feedback.
All reactions