I'm new to flutter and created a quiz app. The app is working and displaying all 6 questions. I want to get 5 random questions from the class questions .I would appreciate your help.
CodePudding user response:
you can get by shuffling the list and then accessing the 5 items from it like below
var randomQuestions = (questions..shuffle()).sublist(0,5);
check out this exmaple