# umesh-042/task-management architecture

> Architecture diagram of the GitHub repository umesh-042/task-management, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/umesh-042/task-management
- Repository: https://github.com/umesh-042/task-management

## Overview

##### Main Components
- Frontend (View): This is the Flutter UI, which includes screens, widgets, and the presentation layer (located in lib/features/tasks/presentation). It handles user interactions such as adding, editing, or deleting tasks.
- ViewModel (Business Logic Layer): The MVVM pattern is implemented here. The ViewModel is responsible for managing state and coordinating between the UI and the underlying data. Here, Riverpod providers (found in lib/features/tasks/presentation/providers and viewmodels) encapsulate this logic.
- Model (Data Layer): This consists of the data entities and domain models (located in lib/features/tasks/domain/entities and lib/features/tasks/domain/models). It also includes data storage and repositories.
- Data Sources: The persistence layer comprises SQLite (lib/features/tasks/data/datasources/sqlite_database.dart) for task information and Hive (lib/features/tasks/data/datasources/hive_database.dart) for user preferences.
- Repository: There is an abstraction layer (lib/features/tasks/data/repositories/task_repository.dart) that encapsulates the logic for data retrieval and storage, acting as a mediator between the ViewModel and the data sources.
- Additional Services: Any notification service for reminders (lib/features/tasks/data/datasources/notification_service.dart) should be represented as an external or internal service that the application interacts with.

##### Relationships and Interactions
- Multi-platform build aspect; represent that the same Flutter UI runs on Android, iOS, web, Linux, macOS, and Windows. This may be depicted in a separate “Platform Specific Shells” section if needed.

##### Architectural Patterns and Design Principles
- Use Riverpod’s state management to show how decoupled the UI is from business logic.
- How the repository pattern ensures a clean separation between data sources and application logic.
- Responsive design principles, given that the app adapts its layout for mobile and tablet (and other) devices.

##### Relevant Technologies and Frameworks
- Framework: Flutter (central block for the UI)
- State Management: Riverpod (embedded in the ViewModel layer)
- Local Storage: SQLite (for tasks) and Hive (for user preferences)
- Architectural Pattern: MVVM
- Optional: Notification Services for local task reminders

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        Screens["Screens (UI)"]
        Widgets["Widgets (UI)"]
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        ViewModels["ViewModels (MVVM)"]
        Providers["Riverpod Providers"]
    end

    %% Data Layer
    subgraph "Data Layer"
        Entities["Entities (Domain)"]
        Models["Models (Domain)"]
        Repository["Task Repository"]
        SQLite["SQLite Database"]
        Hive["Hive Database"]
        Notification["Notification Service"]
    end

    %% Platform Shells for multi-platform support
    subgraph "Platform Specific Shells"
        Android["Android"]
        iOS["iOS"]
        Web["Web"]
        Desktop["Desktop"]
    end

    %% Connections from Presentation to Business Logic
    Screens -->|"userAction"| ViewModels
    Widgets -->|"userAction"| Providers

    %% Connections from Business Logic to Repository
    ViewModels -->|"calls"| Repository
    Providers -->|"calls"| Repository

    %% Repository communicates with Data Layer
    Repository -->|"readWrite"| SQLite
    Repository -->|"readWrite"| Hive
    Repository -->|"usesDomain"| Entities
    Repository -->|"usesDomain"| Models

    %% Repository pushes data updates back to Business Logic
    Repository -->|"dataUpdate"| ViewModels
    Repository -->|"dataUpdate"| Providers

    %% Notification Service sends reminders to UI
    Notification -->|"reminds"| Screens

    %% Link UI to multi-platform shells (dotted lines indicate deployment connections)
    Screens -.-> Android
    Screens -.-> iOS
    Screens -.-> Web
    Screens -.-> Desktop

    %% Style Classes
    class Screens,Widgets,Android,iOS,Web,Desktop presentation
    class ViewModels,Providers business
    class Entities,Models,Repository,SQLite,Hive,Notification data

    %% Click Events for component mappings
    click Screens "https://github.com/umesh-042/task-management/tree/main/lib/features/tasks/presentation/screens"
    click Widgets "https://github.com/umesh-042/task-management/tree/main/lib/features/tasks/presentation/widgets"
    click ViewModels "https://github.com/umesh-042/task-management/tree/main/lib/features/tasks/presentation/viewmodels"
    click Providers "https://github.com/umesh-042/task-management/tree/main/lib/features/tasks/presentation/providers"
    click Entities "https://github.com/umesh-042/task-management/tree/main/lib/features/tasks/domain/entities"
    click Models "https://github.com/umesh-042/task-management/tree/main/lib/features/tasks/domain/models"
    click SQLite "https://github.com/umesh-042/task-management/blob/main/lib/features/tasks/data/datasources/sqlite_database.dart"
    click Hive "https://github.com/umesh-042/task-management/blob/main/lib/features/tasks/data/datasources/hive_database.dart"
    click Repository "https://github.com/umesh-042/task-management/blob/main/lib/features/tasks/data/repositories/task_repository.dart"
    click Notification "https://github.com/umesh-042/task-management/blob/main/lib/features/tasks/data/datasources/notification_service.dart"

    %% Class Definitions for Colors
    classDef presentation fill:#FFCCCB,stroke:#333,stroke-width:2px;
    classDef business fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef data fill:#90EE90,stroke:#333,stroke-width:2px;
```
