Overview
Wonderous uses immutable data classes to represent the core domain models. All data models are located inlib/logic/data/ and use Dart’s const constructors for performance.
WonderData
WonderData is the primary model representing a wonder of the world. It contains all information needed to display a wonder across the app.
Structure
Key Properties
| Property | Type | Description |
|---|---|---|
type | WonderType | Unique identifier enum for the wonder |
title | String | Display name (e.g., “Great Wall of China”) |
subTitle | String | Secondary descriptor |
regionTitle | String | Geographic region |
startYr / endYr | int | Construction date range |
lat / lng | double | Geographic coordinates |
imageIds | List<String> | Asset identifiers for images |
unsplashCollectionId | String | Unsplash API collection ID |
historyInfo1 / historyInfo2 | String | Historical narrative text |
constructionInfo1 / constructionInfo2 | String | Construction details |
locationInfo1 / locationInfo2 | String | Location information |
pullQuote1Top / pullQuote1Bottom | String | Featured quote text |
pullQuote1Author | String | Quote attribution |
facts | List<String> | Quick facts list |
videoId | String | YouTube video identifier |
events | Map<int, String> | Timeline events (year -> description) |
highlightArtifacts | List<String> | Featured artifact IDs |
hiddenArtifacts | List<String> | Collectible artifact IDs |
searchData | List<SearchData> | Search index data |
searchSuggestions | List<String> | Search suggestions |
Computed Properties
Wonder-Specific Data
Each wonder has its own data file inlib/logic/data/wonders_data/:
chichen_itza_data.dartchrist_redeemer_data.dartcolosseum_data.dartgreat_wall_data.dartmachu_picchu_data.dartpetra_data.dartpyramids_giza_data.darttaj_mahal_data.dart
WonderType
WonderType is an enum that identifies each wonder:
ArtifactData
ArtifactData represents artifacts from the Metropolitan Museum of Art API:
Key Properties
| Property | Type | Description |
|---|---|---|
objectId | String | MET API identifier |
title | String | Artifact name |
image | String | Primary image URL |
objectBeginYear / objectEndYear | int | Creation date range |
objectType | String | Type (coin, vase, etc.) |
date | String | Human-readable date |
period | String | Historical period |
country | String | Country of origin |
medium | String | Material/medium |
dimension | String | Physical dimensions |
classification | String | Category |
culture | String | Cultural origin |
Image URLs
Artifacts have multiple image size options:CollectibleData
CollectibleData represents hidden artifacts that users can discover:
Collectible States
Data Definition
Collectibles are defined as a global list:HighlightData
HighlightData represents featured artifacts displayed on wonder detail pages:
TimelineData
TimelineData provides global historical events for the timeline feature:
Wonder-Specific Events
EachWonderData contains its own events map:
UnsplashPhotoData
UnsplashPhotoData represents photos from the Unsplash API:
Data Access Patterns
Accessing Wonder Data
Accessing Collectibles
Accessing Highlights
Immutability
All data models useconst constructors and final fields to ensure immutability:
- Performance: Dart can optimize const objects
- Predictability: Data can’t be accidentally modified
- Safety: No side effects from data mutations
Equatable
WonderData extends Equatable for value-based equality:
- Efficient comparison of wonder instances
- Use in collections (Set, Map)
- State management optimizations
Best Practices
- Immutability: Always use
constconstructors andfinalfields - Type Safety: Use enums (
WonderType) instead of strings for identifiers - Computed Properties: Use getters for derived data (
titleWithBreaks,imageUrl) - Static Methods: Provide static factory methods for lookups (
fromId,forWonder) - Null Safety: Use nullable types where appropriate and provide null-safe accessors
- Constants: Define magic numbers and paths as named constants
Related Files
lib/logic/data/wonder_data.dart- WonderData modellib/logic/data/wonder_type.dart- WonderType enumlib/logic/data/artifact_data.dart- ArtifactData modellib/logic/data/collectible_data.dart- CollectibleData model and datalib/logic/data/highlight_data.dart- HighlightData model and datalib/logic/data/timeline_data.dart- Timeline event modelslib/logic/data/wonders_data/- Wonder-specific data files