🎮 Project: Interactive Quiz Game

📚 Lesson 2: User Input & Interactivity ⏱ 25-30 min 📊 Beginner
🎯 Objective

Build an interactive multiple-choice quiz that tests knowledge of Dart programming concepts, accepts user answers, tracks scores, and provides detailed results.

Requirements

  1. Create at least 5 quiz questions about Dart basics
  2. Each question should have 4 multiple choice options (A, B, C, D)
  3. Accept user input for each answer and validate it
  4. Keep track of correct answers count
  5. Display the final score as both count and percentage
  6. Show which questions were answered incorrectly
  7. Handle invalid inputs gracefully (empty, wrong letters)
  8. Display a performance message based on the score

Expected Output

Terminal
╔══════════════════════╗
║   Dart Quiz Game     ║
╚══════════════════════╝

Question 1 of 5:
What is the entry point of a Dart program?
  A) start()
  B) main()
  C) init()
  D) run()

Your answer (A/B/C/D): B
✅ Correct!

Question 2 of 5:
Which keyword is used for compile-time constants?
  A) var
  B) final
  C) const
  D) static

Your answer (A/B/C/D): C
✅ Correct!

[... more questions ...]

╔══════════════════════╗
║       RESULTS        ║
╚══════════════════════╝
Score: 4/5 (80%)

Incorrect Questions:
  ❌ Q3: What does JSON stand for?
     Your answer: A | Correct answer: D

📊 Performance: Good job! Keep learning.

Step-by-Step Hints

💡 Hint 1: Data Structure

Use a List<Map<String, dynamic>> to store questions. Each question is a Map with 'question', 'options' (a List), and 'correct' (the answer letter).

💡 Hint 2: Input Validation

Convert user input to uppercase with .toUpperCase(). Check if it's one of 'A', 'B', 'C', 'D' before processing.