How codolingo/mobile works
Project Type and Purpose
• This is a cross-platform Flutter front-end (mobile, web, desktop) for a language-learning app.
• It follows an MVVM pattern with clear separation of UI (widgets), state (ViewModels), domain models, data access (Repositories & Services), and static/dummy data.
• It supports multiple “flavors” (dev, dummy, staging, prod) via different entry points (main_dev.dart, main_dummy.dart, etc.) and providers (live vs. dummy).
File Structure
• Top-level platform folders: android/, ios/, linux/, macos/, windows/, web/.
• Shared UI and logic live under lib/:
• components/ (Atoms → Molecules → Organisms) – widget building blocks
• pages/ – screen definitions + their ViewModels
• model/ – API DTOs (model/api/), domain classes (model/class/), MVVM events & ViewModel base
• services/api/ – HTTP calls (live & dummy subpackages)
• repositories/ – orchestrate Services + Transformers
• transformers/ – convert raw API data → domain models or UI-friendly objects
• providers/ – configure dependency injection (GetIt) for Dummy vs. Live vs. both
• main_*.dart – flavor entrypoints
Key Architectural Patterns
• MVVM:
UI Widgets ↔ ViewModels ↔ Repositories ↔ Services ↔ External API or Static JSON
• Dependency Injection: using GetIt
• Flavor-based configuration: different DI bindings for dev/dummy/staging/prod
Main Components
A. Platform Host & Flutter Engine
– Android, iOS, macOS, Linux, Windows, Web embed layer
– Flutter Engine
B. Flutter Application
1. Entrypoint (flavor-specific main_*.dart)
2. Dependency Injection Container (GetIt)
C. UI Layer
– Atomic widgets (components/atoms)
– Composite widgets (molecules, organisms)
– Screens/Pages (pages/...View.dart)
D. MVVM Layer
– ViewModels (pages/*/*_view_model.dart)
– MVVM events (model/mvvm/...)
E. Domain & Data Layer
– Domain Models (model/class)
– API DTOs (model/api)
– Transformers (transformers/)
– Services (services/api/live & services/api/dummy)
– Repositories (repositories/api_repository.dart, lesson_repository.dart)
F. External Systems
– Live Backend API (REST endpoints)
– Static JSON files (dummy provider)
– UI Widget → ViewModel: user actions / data bindings
– ViewModel → Repository: request data
– Repository → Transformer → Domain Model
– Repository → Service → External API or Static JSON → Transformer
– ViewModel ← Repository: emits domain models / updates
– UI ← ViewModel: observes ViewModel streams or events