How alexisl61/fluttertemplate works
Project type and purpose
• This is a cross-platform Flutter application template with built-in dependency injection (get_it) and an MVVM folder architecture.
• It targets Android, iOS, Linux, macOS, Windows, and web, but the heart of the logic lives in lib/.
File structure
• Top-level directories (android, ios, linux, macos, web, windows) contain platform-specific boilerplate generated by Flutter.
• The lib/ directory contains the core architecture:
• components/ (atoms, molecules, organisms) – reusable UI widgets
• pages/ – full-screen views, each paired with a ViewModel
• model/ – data classes + MVVM core (ViewModel base, events, observer)
• providers/ – environment split (Dummy vs Live) and dependency wiring
• services/ – data retrieval logic (dummy, live, core)
• repositories/ – combine services + transformers
• transformers/ – map raw data into data classes
• utils/ – extensions and helper functions
• Configuration files: pubspec.yaml for dependencies, analysis_options.yaml for lint rules.
Insights from the README
• Two entry points (main_dummy.dart, main_live.dart) switch the provider environment.
• Architectural flow: Page ↔ ViewModel → Repository → {Transformer, Service} → DataClass.
• DI is handled by get_it inside the provider files.
a. Main Components
1. Flutter Shell (the engine & platform runner across Android, iOS, etc.)
2. UI Layer
– Pages (full screens)
– Components (atoms, molecules, organisms)
3. Presentation Logic
– ViewModels (one per page or component when complex)
4. Data Layer
– Repositories
– Services (dummy or live implementations)
– Transformers
– Data Classes (models)
5. Dependency Injection Container (get_it)
6. External API (if Live provider) or Static Data (Dummy provider)
b. Relationships & Data Flow
• Pages render Components and bind to their ViewModel.
• Components may send UI events back to their parent ViewModel.
• ViewModel requests data from a Repository.
• Repository invokes Service and Transformer in parallel or sequence.
• Repository returns Data Classes back to ViewModel, which notifies the Page.
• Provider (Dummy or Live) at app start configures get_it with the correct Repository implementations.
c. Architectural Patterns & Principles
• MVVM with explicit ViewModel for state and event management.
• Dependency Injection via get_it, configured by environment-specific providers.
• Layered architecture: Presentation → Domain (ViewModel) → Data (Repo/Service/Transformer).
• Component-based UI (atomic design: atoms → molecules → organisms).
d. Key Technologies & Frameworks
• Flutter SDK (Dart)
• get_it for DI
• Provider pattern for environment switching
• Dart built_ins and extensions (utils)
Don’t Overthink—Capture Every Piece
• Directories from lib/ that map to a runtime component.
• Provider switch (Dummy vs Live) clearly at startup.
• How utility extensions and transformers fit into the data flow.