I am new at FLutter and I want to try to make authorization but I don't know how to do it properly.
I have multiple screens with inputs
First screen: Choose country in textFormField => Second screen: type name, email in textFormFields => Third screen: type and confirm password in textFormFields
And when I press sign up button, I should send country, name, email and password to a server.
But where to store values of previous screens. Should I just transfer all data from one screen to another using navigator, or there is a better solution?
I know in React exists redux or mobX(state manager) but do we have something similar in flutter?
CodePudding user response:
Should I just transfer all data from one screen to another using navigator
No, this will work but, when your project grows up, it will be a mess.
I know in React exists redux or mobX(state manager) but do we have something similar in flutter?
Yes, Flutter have redux and mobX lib too, you can take a look on flutter_redux, mobx, and some other famous state management: provider, flutter_bloc. If you are a new one, I think provider will be easier to learn, bloc is more boilerplate code but it'll be good with big projects.
CodePudding user response:
You don't have to send all data from one screen, but it depends on which state management method you will use, you can save the data in the controller if you decide to use (provider, Getx) or in a cubit, if you choose to use(Cubit state management )