This video covers creating an answers array for your Flutter quiz app. In this video, learn how to compare user input to a specific index item in your array.
- [Narrator] So notice that all that we did … is we created a list of questions where we copied over … the questions from down here … and we've only got three of them. … And then we created a variable to track where we are … in the list of questions and it's start from zero. … And then down here where we have our text widget, … the text that we chose to display in it … comes from our list of questions, pulling in the item … at this particular index. … And then down here in our onPressed … for our true and false buttons, we use setState … to update our question number and update the screen … when the user presses the true or the false button. … Now we can use hot restart then we reset our question … number back down to zero and we can cycle through … our questions until we run out of questions … at which point we get a range error because we don't have … any more questions to display. … So now that we've done that, the next part is to create … a list of matching answers. … So right below our questions here we're going to create …
This course was created by London App Brewery. We are pleased to host this content in our library.