Professional Documents
Culture Documents
Variable Initialization: At the start, various variables and lists are established to manage
the current question and the overall set of questions. The integer curQ is used to track the
current question. Four lists of maps (questionData, hardQ, midQ, and easyQ) are then
defined. Each map represents an individual question, which can include attributes like the
question title, the possible answers, and the correct answer. questionData is a master list
containing all the questions, whereas hardQ, midQ, and easyQ store the questions based
2. Lifecycle Method - initState(): This is a specific method used in Flutter, and it's the first
method to run when the widget is created, happening just once, right after the constructor.
3. Data Fetching - fetchQuestionData(): This asynchronous function is critical as it retrieves
Firebase. After the data has been fetched, the questions are added to the questionData list
4. Functionality Methods: The functions nextQuestion(), addToHardQ(), addToMidQ(), and
addToEasyQ() make up the core functionality of the app. nextQuestion() serves to cycle to the
next question in the questionData list. If the list is empty, it remains inactive. The other three
respective difficulty list and then remove it from the questionData list. They also reset curQ (the
timers that run for different durations (10 seconds, 1 minute, and 2 minutes, respectively).
Once a timer ends, it checks if there are any questions left in the difficulty list (hard,
medium, easy). If there are, it moves the first question back to the questionData list and