I have eight screens. The first 7 screen has data to be sent to the last screen how do I go arouund this??
I tried passinng it through from one parent to another but that is too much work
I have eight screens. The first 7 screen has data to be sent to the last screen how do I go arouund this??
I tried passinng it through from one parent to another but that is too much work
2
Answers
why don’t you use a state management like
provider
???if you don’t use a state management it’ll be hard to use datas from one screen to another step by step.
you can create a class like this:
as you see when
_yourData
is changed, it tells you and you can use this data where ever you want by providingExpampleClass
,even you can set a data in your first screen and use that data in the last screen without passing data step page by step.and even you can use that data in your widgets like this by using
Consumer
everywhere you want:***be careful to use MultiProvider in your first root class of your project to define your providers.
here is provider package document. read it carefully.
you need an global state solution, like provider, riverpod, getx etc …
there’s good book on this in amazon "Managing State in Flutter Pragmatically”