How dev-adnani/flutter-mvvm-template works
Project Type and Purpose
• This is a cross-platform Flutter client application (Android, iOS, Web, macOS, Windows, Linux) following the MVVM (Model-View-ViewModel) pattern.
• It uses Provider for state management and communicates with remote APIs and optional local storage.
File Structure
• The lib/ directory holds the core app:
– data (local + remote)
– models
– repository
– view_model
– view (screens + shared widgets)
– utils
– main.dart (app entry point)
Key Architectural Patterns
• MVVM: View ↔ ViewModel ↔ Repository ↔ DataSources
• Provider: injects ViewModel into the Widget tree
• Repository abstracts over local vs. remote data
• Network layer for HTTP calls, optional local DB layer for caching
Relationships & Data Flow
• UI Widgets → read/write → ViewModel (using Provider)
• ViewModel → calls → Repository
• Repository → routes calls → RemoteAPIService or LocalDataSource
• RemoteAPIService → HTTP calls → External API → returns Response → mapped to Models
• LocalDataSource → reads/writes → local.db
• Models flow back up: DataSource → Repository → ViewModel → UI
Technologies & Frameworks
• Flutter/Dart (core engine)
• Provider (state management)
• HTTP client (e.g., network.api.service.dart)
• SQLite or simple file (local.db.txt)
• Platform embedder (Android Gradle, Xcode, CMake for desktop)
Essential Details to Capture
• main.dart (App entry) initializes Providers
• API endpoints configured in api.end.points.dart
• BaseApiService → inherited by NetworkApiService
• app.exceptions.dart for error flow from remote calls up to UI