flutteruistepper

forms keys null value when jumping to the last step and expanding component inside. Flutter


So I building an application with Flutter with BloC where user needs to complete tasks with a lot of steps. some of them are also images and damages. Every step has a separate form, and we validate at the end of the stepper all forms at once. In the last form there are also custom elements, expendable cards, that show some data.

The problem I get is that the keys from forms for previous steps currentState are null when I open the expendable card and click continue in the step. But if I minimize the expendable card, the key.currentState is there there.

I do not see any reloading being done in the parent elements step, stepper. For which reason, would in case of expanded card the keys be null?

I tried to go through steps in the code in initialization after they are built, and the revert back to step 1, but it didn't work. On user clicking I still get the same error.


Solution

  • I have found that in my case, I had the problem, because of Column() as the parent of stepper and form. The problem was in connection to how the Column() loads children.

    I fixed it with using ListView() instead of Column().