# xlxl85/vipul_task_master architecture

> Architecture diagram of the GitHub repository xlxl85/vipul_task_master, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xlxl85/vipul_task_master
- Repository: https://github.com/xlxl85/vipul_task_master

## Overview

##### Project Type and Purpose
- QuickTask is a mobile‑only Flutter application (Android & iOS).
- It follows Uncle Bob’s Clean Architecture, with BLoC for state management, Hive for local storage, and Cloud Firestore for remote storage.

##### File Structure
- Top‑level mobile projects: android/, ios/, assets/, lib/, test/
- lib/ subdivided into:
- core/      (shared constants, DI, router, services, themes, utils)
- data/      (datasources/local Hive & remote Firestore, models, repos impl)
- domain/    (entities, repository interfaces, use‑cases)
- presentation/ (UI screens, widgets, BLoCs)
- Configuration files: pubspec.yaml, android/manifest, iOS plist, build scripts.

##### README for Insights
- Confirms: Clean Architecture layers, BLoC pattern (events → states → blocs), dual storage (Hive & Firestore), DI via get_it, routing via go_router, local notifications, device info service.

##### Main Components
a. Presentation Layer
- UI Widgets & Screens
- BLoCs (tasks_bloc, theme_cubit)
- Router (go_router)
b. Domain Layer
- Entities (Task)
- Use Cases (e.g., getTasks, addTask, updateTask)
- Repository Interfaces (TaskRepository)
c. Data Layer
- Repositories Impl (TaskRepositoryImpl)
- Data Sources:
- Local: HiveService
- Remote: FirestoreService
- Data Models & Mappers (TaskModel ↔ Task entity)
d. Core Services
- Service Locator (get_it)
- NotificationService (flutter_local_notifications)
- DeviceInfoService
- AppConstants & HiveConstants
- AppTheme
e. External Systems
- Cloud Firestore
- Hive Local Database
- OS Notification API (Android & iOS)
- Device Info API

##### Relationships and Data Flows
- User taps UI → Presentation emits Event → BLoC
- BLoC invokes Use Case in Domain
- Use Case calls Abstract Repository → Data Layer
- RepositoryImpl chooses Local or Remote DataSource based on logic
- DataSource returns Model → Repository maps to Entity → Use Case returns result
- BLoC emits new State → UI rebuilds
- NotificationService schedules jobs via OS Notification API
- DeviceInfoService provides device ID to Use Cases

##### Architectural Patterns & Principles
- Clean Architecture (separate presentation, domain, data)
- BLoC pattern (unidirectional data flow)
- Dependency Injection (service locator for loose coupling)
- Repository pattern (abstraction over data sources)
- Offline‑first design (Hive fallback)
- External‑integration isolation (Firestore, Notifications)

- Clear component labels (e.g., “TaskRepositoryImpl”)
- Annotations for key technologies (flutter_bloc, get_it, hive, cloud_firestore)
- External dependencies positioned at the edge

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        UI_Screens["UI Screens"]:::presentation
        UI_Widgets["UI Widgets"]:::presentation
        TasksBloc["Tasks BLoC"]:::presentation
        ThemeCubit["Theme Cubit"]:::presentation
        Router["App Router"]:::presentation
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        TaskEntity["Task Entity"]:::domain
        TaskRepository["TaskRepository Interface"]:::domain
        TaskUseCases["Task Use Cases"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        TaskRepoImpl["TaskRepositoryImpl"]:::data
        HiveService["HiveService"]:::data
        FirestoreService["FirestoreService"]:::data
        TaskModel["TaskModel & Mapper"]:::data
    end

    %% Core Services
    subgraph "Core Services"
        direction TB
        ServiceLocator["Service Locator"]:::core
        NotificationService["Notification Service"]:::core
        DeviceInfoService["DeviceInfo Service"]:::core
        AppConstants["App Constants"]:::core
        HiveConstants["Hive Constants"]:::core
        AppTheme["App Theme"]:::core
        Utils["Date/Time Utils"]:::core
    end

    %% External Systems
    subgraph "External Systems"
        direction TB
        FirestoreDB["Cloud Firestore"]:::external
        HiveDB["Hive Local DB"]:::external
        OSNotifAPI["OS Notification API"]:::external
        DeviceInfoAPI["Device Info API"]:::external
    end

    %% Relationships
    UI_Screens -->|"user taps"| TasksBloc
    UI_Widgets -->|"renders state"| UI_Screens
    Router -->|"routes events"| TasksBloc
    ThemeCubit -->|"provides theme"| UI_Screens

    TasksBloc -->|"dispatches events"| TaskUseCases
    TaskUseCases -->|"calls repo interface"| TaskRepository
    TaskRepository -->|"implemented by"| TaskRepoImpl

    TaskRepoImpl -->|"local data"| HiveService
    TaskRepoImpl -->|"remote data"| FirestoreService
    HiveService -->|"reads/writes"| HiveDB
    FirestoreService -->|"queries"| FirestoreDB

    FirestoreService -->|"maps model"| TaskModel
    TaskRepoImpl -->|"maps entity"| TaskModel
    TaskModel -->|"to Entity"| TaskEntity
    TaskEntity --> TaskUseCases

    NotificationService -->|"schedules"| OSNotifAPI
    DeviceInfoService -->|"fetches info"| DeviceInfoAPI

    ServiceLocator --> ServiceLocator -.-> TasksBloc
    ServiceLocator --> ServiceLocator -.-> TaskUseCases
    ServiceLocator --> ServiceLocator -.-> TaskRepoImpl
    ServiceLocator --> ServiceLocator -.-> HiveService
    ServiceLocator --> ServiceLocator -.-> FirestoreService
    ServiceLocator --> ServiceLocator -.-> NotificationService
    ServiceLocator --> ServiceLocator -.-> DeviceInfoService

    %% Click Events
    click UI_Screens "https://github.com/xlxl85/vipul_task_master/tree/main/lib/presentation/screens/"
    click UI_Widgets "https://github.com/xlxl85/vipul_task_master/tree/main/lib/presentation/widgets/"
    click TasksBloc "https://github.com/xlxl85/vipul_task_master/blob/main/lib/presentation/blocs/task/tasks_bloc.dart"
    click ThemeCubit "https://github.com/xlxl85/vipul_task_master/blob/main/lib/presentation/blocs/themecubit/theme_cubit.dart"
    click Router "https://github.com/xlxl85/vipul_task_master/blob/main/lib/core/router/app_router.dart"
    click TaskEntity "https://github.com/xlxl85/vipul_task_master/blob/main/lib/domain/entities/task.dart"
    click TaskRepository "https://github.com/xlxl85/vipul_task_master/blob/main/lib/domain/repositories/task_repository.dart"
    click TaskUseCases "https://github.com/xlxl85/vipul_task_master/blob/main/lib/domain/usecases/task_usecases.dart"
    click TaskRepoImpl "https://github.com/xlxl85/vipul_task_master/blob/main/lib/data/repositories/task_repository_impl.dart"
    click HiveService "https://github.com/xlxl85/vipul_task_master/blob/main/lib/data/datasources/local/hive_service.dart"
    click FirestoreService "https://github.com/xlxl85/vipul_task_master/blob/main/lib/data/datasources/remote/firestore_service.dart"
    click TaskModel "https://github.com/xlxl85/vipul_task_master/blob/main/lib/data/models/task_model.dart"
    click ServiceLocator "https://github.com/xlxl85/vipul_task_master/blob/main/lib/core/di/service_locator.dart"
    click NotificationService "https://github.com/xlxl85/vipul_task_master/blob/main/lib/core/services/notification_service.dart"
    click DeviceInfoService "https://github.com/xlxl85/vipul_task_master/blob/main/lib/core/services/device_info_service.dart"
    click AppConstants "https://github.com/xlxl85/vipul_task_master/blob/main/lib/core/constants/app_constants.dart"
    click HiveConstants "https://github.com/xlxl85/vipul_task_master/blob/main/lib/core/constants/hive_constants.dart"
    click AppTheme "https://github.com/xlxl85/vipul_task_master/blob/main/lib/core/themes/app_theme.dart"
    click Utils "https://github.com/xlxl85/vipul_task_master/blob/main/lib/core/utils/date_time_utils.dart"

    %% Styles
    classDef presentation fill:#CCE5FF,stroke:#0066CC,color:#000;
    classDef domain fill:#CCFFCC,stroke:#009933,color:#000;
    classDef data fill:#FFE5CC,stroke:#CC6600,color:#000;
    classDef core fill:#EEEEEE,stroke:#666666,color:#000;
    classDef external fill:#FFFFFF,stroke-dasharray: 5 5,stroke:#000,color:#000;
```
