Dealing with future builders / uninitialized form fields #1366
Closed
Adam-Langley
started this conversation in
General
Replies: 1 comment
-
Hi @Adam-Langley |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using Skeletonizer:
https://pub.dev/packages/skeletonizer
This means that while I'm loading my form data from a repository, using futures/streams, I will still render my entire form, but wrapped in a Skeletonizer and populated with dummy data.
This causes a problem that all the form elements are hence first built with 'initialValue' of some irrelevent value (such as null). Then, when the future completes, and the form data is loaded - it rebuilds again and nothing really rebuilds - all the form elements are still empty.
One option is to build the form fields with some "magic" initialValue - however this is terrible, it will completely break the 'isDirty' flag.
What's the solution here?
I really need a way to force a Form Field to "re-initialize" once the form data goes from 'loading' to 'loaded'... ideas?
Beta Was this translation helpful? Give feedback.
All reactions