I want to put objects randomly, then on new screen I want player to put widgets as before. How can I do that?
What widgets/ packages would make it easy?
I want to put objects randomly, then on new screen I want player to put widgets as before. How can I do that?
What widgets/ packages would make it easy?
Say you have a list of objects in your widget, that is displayed in order by the build
function.
You could use initState
to shuffle your list the first time your widget loads, using a shuffle function such as the one provided in this other StackOverflow answer.
List<MyItem> items = [MyItem('first'), MyItem('second'), MyItem('third')];
@override
initState() {
items = shuffle(items);
super.initState();
}
Then when going to the next screen, you can pass the shuffled version of items
, and use that as the 'correct' solution.
It's a bit difficult to see what exactly you're looking for as no code was provided, but hopefully this gives you some inspiration for your actual problem.