i've created a 2 lists of values. I mean, i have 2 lists with different values. Also i have a button with action to change bool value. If its true it will generate random value from cars List and false will generate random value from sportcars List. But i dont want to generate random value. I want to generate first value, then change to second, third, fourth,... and repeat this cycle
bool or = true;
child: Text(
or ? cars[Random().nextInt(cars.length - 1)] : sportcars[Random().nextInt(sportcars.length - 1)],
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
),
),
child: FloatingActionButton(
heroTag: null,
onPressed: () {
setState(() {
or = false;
});
},
child: FloatingActionButton(
heroTag: null,
onPressed: () {
setState(() {
or = true;
});
},