How kit-g/heart-of-yours works
Main Components
▪ Frontend/Mobile UI: Represented by the Flutter “lib” folder, particularly the presentation layer (inside lib/presentation) and its associated widgets. Indicate that this layer handles the user interface and interacts with state and business logic via Provider.
▪ Core App Logic & State Management: The “heart_state” package (within shared/heart_state) contains all business logic and state management, exposing the Provider package to the app. This is your MVVM “view-model”.
▪ Data Layer: This is further separated into several modules:
– heart_models: Contains the data models and domain objects.
– heart_db: Abstracts the local database operations.
– heart_language: Provides localization and language support.
▪ Platform-Specific Code: Android (android directory) and iOS (ios directory) code are tailored for the respective platforms.
▪ External Dependencies: Firebase is used as the backend (although its API is hidden inside heart_state) and Sentry for error logging; as mentioned, the app never directly accesses Firebase so this promotes separation of concerns.
Relationships and Interactions
▪ The UI layer (Flutter screens and widgets) communicates with the ViewModel layer (heart_state) via Provider for state management.
▪ The data layer (heart_models, heart_db, and heart_language) resides in shared packages and is consumed by heart_state to get, process, and persist data.
▪ Firebase, as the backend, is integrated inside heart_state and handles asynchronous database operations; this dependency is kept internal and is not exposed to the UI layer.
Architectural Patterns and Design Principles
▪ Separation of Concerns: The “data layer” has been completely factored into separate packages which interact only through the heart_state package.
▪ Dependency Injection / Provider: Use a Provider-based approach to connect UI with business logic.
▪ Environment Configuration and Flavors: The inclusion of different flavors (dev, prod, etc.) with separate configurations (env/dev.json) should be shown as part of the deployment/configuration process.
Relevant Technologies, Frameworks, and Libraries
▪ Flutter & Dart for cross-platform (Android/iOS) mobile development.
▪ Provider for state management.
▪ Firebase as the backend service (accessed indirectly through heart_state).
▪ Sentry for error logging.
▪ The shared packages (heart_models, heart_db, heart_language, heart_state) provide modularity and potential reuse across different parts of the app.