šŸ“° Project: News API Parser

šŸ“š Lesson 9: JSON & Data Models ā± 30-35 min šŸ“Š Intermediate
šŸŽÆ Objective

Build a complete JSON parsing system for news articles. Create model classes with factory constructors, pattern matching for safe extraction, and methods to display formatted news.

Requirements

  1. Create model classes: NewsArticle, NewsSource, NewsResponse
  2. Use factory constructors with fromJson() for all models
  3. Implement pattern matching for safe JSON extraction
  4. Handle nested JSON objects (source inside article)
  5. Implement toJson() for serialization back to JSON
  6. Create a display method that formats articles nicely
  7. Handle missing/optional fields gracefully

Expected Output

Terminal
╔══════════════════════════════════╗
ā•‘       NEWS API PARSER             ā•‘
ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•

šŸ“° Parsing news data...

āœ… Successfully parsed 3 articles

─────────────────────────────────────
šŸ“° Dart 3.5 Released with New Features
   šŸ“… 2026-05-20 | āœļø Jane Doe
   šŸ“ dartweekly.com
   šŸ“ Dart 3.5 brings exciting new features including...
   šŸ·ļø #dart #programming #release

šŸ“° Flutter Conference 2026 Announced
   šŸ“… 2026-05-19 | āœļø John Smith
   šŸ“ technews.io
   šŸ“ The annual Flutter conference will be held...
   šŸ·ļø #flutter #conference #tech

šŸ“° Google IO Highlights for Developers
   šŸ“… 2026-05-18 | āœļø Sarah Wilson
   šŸ“ devblog.com
   šŸ“ Key announcements from Google IO that matter...
   šŸ·ļø #google #io #developer
─────────────────────────────────────