This capstone project combines every concept from the course into a single, productionβready commandβline tool. You'll create a multiβpackage workspace with a polished CLI, robust error handling, structured logging, and unit tests.
π― Project Overview
Create a CLI tool called Wiki Explorer Pro that allows users to:
Search Wikipedia articles and display results with URLs
Get a summary of any article by title
View article extracts in plain text or HTML
Compare two articles sideβbyβside
Export search results or summaries to a JSON file
Log all requests and errors to daily log files
Run in interactive mode with a menu, or accept direct commands
ποΈ Architecture Requirements
Your project must use a multiβpackage workspace with at least three packages:
command_runner β A reusable CLI framework (commands, arguments, help)
wikipedia β API client with model classes and JSON parsing
cli β The main application entry point and concrete commands
Each package should have its own pubspec.yaml and be linked via a root workspace.
π Detailed Requirements
1. Command Runner Package
Abstract Command class with name, description, run()
Support for flags and options (e.g., --verbose, --output)
Builtβin HelpCommand that displays usage for all commands
Custom ArgumentException for invalid user input
CommandRunner class that parses input and dispatches commands
2. Wikipedia Package
Model classes: SearchResult, ArticleSummary, Article
Use pattern matching in fromJson() factories
Methods: search(), getSummary(), getArticle()
Simulated API calls with realistic delays (use Future.delayed)
Interactive mode when no arguments given (menu loop)
Accept commandβline arguments for direct execution
Logging: create a logger that writes to logs/YYYY_MM_DD_wiki.log
Log all searches, errors, and API response times
Graceful error handling with userβfriendly messages
4. Testing
Unit tests for Wikipedia model classes (valid JSON, invalid JSON, missing fields)
Tests for CommandRunner argument parsing
At least 10 test cases total
πΊ Expected Behavior
Terminal (Direct Mode)
$ dart run bin/cli.dart search Dart programming
π Searching for "Dart programming"...
1. Dart (programming language) - https://en.wikipedia.org/wiki/Dart_(programming_language)
2. Dartmoor - https://en.wikipedia.org/wiki/Dartmoor
3. Dartford - https://en.wikipedia.org/wiki/Dartford
β Search completed in 1.2s
$ dart run bin/cli.dart summary Dart
π Dart (programming language)
ββββββββββββββββββββββββββββββββββββββ
Dart is a programming language designed by Lars Bak and Kasper Lund and developed by Google. It can be used to develop web and mobile apps as well as server and desktop applications.
ββββββββββββββββββββββββββββββββββββββ
π https://en.wikipedia.org/wiki/Dart_(programming_language)
$ dart run bin/cli.dart compare Dart Flutter
π Comparing Articles
ββββββββββββββββββββββββββββββββββββββ
Dart | Flutter
ββββββββββββββββββββββββββββββββββββββ
Programming language | UI toolkit
Developed by Google | Developed by Google
First appeared 2011 | First appeared 2017
ββββββββββββββββββββββββββββββββββββββ
π Click to reveal the complete solution (build it yourself first!)
name: _
publish_to: none
environment:
sdk: ^3.12.0
workspace:
- cli
- command_runner
- wikipedia
name: command_runner
description: A reusable CLI command framework.
version: 1.0.0
resolution: workspace
environment:
sdk: ^3.12.0
library command_runner;
export 'src/command.dart';
export 'src/command_runner_base.dart';
export 'src/exceptions.dart';
abstract class Command {
final String name;
final String description;
final List
π§ͺ Testing Requirements
Create at least these tests in the wikipedia/test folder:
Dart (test/models_test.dart)
import 'package:test/test.dart';
import 'package:wikipedia/wikipedia.dart';
void main() {
group('SearchResult', () {
test('fromJson parses correctly', () {
final json = {'title': 'Dart', 'url': 'https://en.wikipedia.org/wiki/Dart'};
final result = SearchResult.fromJson(json);
expect(result.title, equals('Dart'));
expect(result.url, contains('wikipedia.org'));
});
});
group('ArticleSummary', () {
test('fromJson with all fields', () {
final json = {
'title': 'Dart',
'extract': 'Dart is a programming language',
'description': 'Programming language',
'content_urls': {'desktop': {'page': 'https://en.wikipedia.org/wiki/Dart'}},
};
final summary = ArticleSummary.fromJson(json);
expect(summary.title, 'Dart');
expect(summary.description, 'Programming language');
});
test('throws FormatException on invalid JSON', () {
expect(() => ArticleSummary.fromJson({}), throwsFormatException);
});
});
}
π Congratulations!
Completing this capstone project means you can design, structure, and implement a realβworld Dart application from scratch. You've mastered packages, async programming, JSON handling, error management, logging, and testing β skills that directly transfer to Flutter and backend Dart development.