I figured already how to transfer data from one page to another but I found a challenge...
This is the code I wrote to pass data from pg1 to pg2. [6]: https://i.stack.imgur.com/u2etq.png the problem with this approach is: leftPlayer[index] , because only the data on the left it's updated on pg2, but not the data on the right side.
This is the code I used inside pg2 to update a team's image data.imageUrl. [5]: https://i.stack.imgur.com/PSkFf.png
This is how I structured the matches: (and I believe this could be the problem because I'm not using the rightPlayer data on the code(3rd point) to pass data to the 2nd pg). leftPlayer and rightPlayer
So, how can I fix this?
You need to pass a values to a next screen class constructor.
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FootbalScreen(leftPlayer[index]),
),
);
RouteSettings
useful when you defining routing on an app main class and all routing managed in this class. You can read more about routing organization in Documentation .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.