Intermediate Projects
Prerequisites: Level 2 — Intermediate
Build these using classes, enums, records, sealed classes, exceptions,
async/await, packages, JSON, and tests from Level 2. Give each project its
own dart create project with tests.
1. Expense Tracker
Model an Expense class (amount, category enum, date) with toJson and
fromJson methods. Save and load expenses in a JSON file, and print a
monthly report grouped by category. Throw a custom exception for invalid
amounts, and cover the logic with package:test.
2. Weather Command-Line App
Call a free weather API with package:http, decode the JSON into Dart
classes, and print the current temperature for a city given as a
command-line argument. Handle network errors and non-200 responses
gracefully.
3. Library System with Sealed Results
Model books, members, and loans, and represent the outcome of borrowing as
a sealed class (Borrowed, NotAvailable, LimitReached). Use an
exhaustive switch expression to print a message for each outcome.
4. File Organizer
List a folder's files with Directory.list(), and move each into a
subfolder by extension (images/, documents/, other/). Add a
--dry-run flag that only prints what would happen.