Reputation: 219
I have created a button, which is changing bool value, but when i click button so fast in row then it throw this error:
RangeError (index): Invalid value: Not in inclusive range 0..3: 4
Upvotes: 2
Views: 648
Reputation: 219
I had 2 list of texts and i wanted it to generate one of them when bool value was true or false. So I use this code
or ? truths[Random().nextInt(truths.length - 1)] : dares[Random().nextInt(dares.length - 1)]
insted of this code
or ? truths[Random().nextInt(truths.length)] : dares[Random().nextInt(dares.length)]
Upvotes: 0
Reputation: 8607
It sounds like you are chaning some list on that page. Maybe based on that bool value that is changed when you are pressing the button.
Upvotes: 1