I have a list of statefull widget which I use to navigate from pages. but when I was trying to push these List element in Navigator.push(), it says "Reading static variable during its initialization".
here's the list:
List<ActionScreen> fullBodyNavigation = [
ActionScreen(title: 'demo data', number: 20, gifDirectory: "assets/gifs/demodata.gif", currentList: fullBodyNavigation,
frameMin: 0, frameMax: 17, milisecondAnimation: 800, milisecondTimer: 800, sessionNumber: 1,),
ActionScreen(title: 'demodata', number: 15, gifDirectory: "assets/gifs/demodata.gif", currentList: fullBodyNavigation,
frameMin: 0, frameMax: 30, milisecondAnimation: 1200, milisecondTimer: 1200, sessionNumber: 2,),
ActionScreen(title: 'demodata', number: 15, gifDirectory: "assets/gifs/demodata.gif", currentList: fullBodyNavigation,
frameMin: 0, frameMax: 2, milisecondAnimation: 2000, milisecondTimer: 2000, sessionNumber: 3,),
.............
]
here's the push method:
onPress: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => fullBodyNavigation[0],),);
},
I foud a solution in stackoverflow which said I have to use 'data' such as "fullBodyNavigation.data[0]". but ide said "getter data is not defined". can anyone pls help?
here's that solution's link: Reading static variable during its initialization | Flutter