# qutaibaqusai/heartful-care architecture

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

- Interactive diagram: https://gitdiagram.com/qutaibaqusai/heartful-care
- Repository: https://github.com/qutaibaqusai/heartful-care

## Overview

##### Project Type and Purpose
- This is a multi-platform (Android, iOS, Web, Windows, macOS, Linux) Flutter application.
- It follows a client-side-only architecture, relying on Firebase Authentication (and likely other Firebase services) and local utilities.
- State management is handled via Provider (lib/provider/myprovider.dart).
- Code is organized by feature (Medical Devices, Nurse Centers, Profile, User Settings, Authentication, Intro flow).

##### Main Components
A. Platform Embedders
– Android (android/)
– iOS (ios/)
– Web (web/)
– Windows (windows/)
– macOS (macos/)
– Linux (linux/)
- These directories contain native host code (build scripts, platform channel setup).
B. Flutter Engine & Dart VM
- The shared runtime that compiles/runs Dart code on each host.
C. Application Layers (lib/)
1. Presentation Layer
– widgets/ (reusable UI widgets)
– sections/ (feature-specific UI flows for MedicalDevices and NurseCenters)
– the various Dart screen files (e.g., login_screen.dart, signup_screen.dart, supplier_home.dart, center_home_page.dart).
2. State Management Layer
– provider/myprovider.dart
- Exposes ChangeNotifiers, holds application state and business logic.
3. Domain/Model Layer
– model/ (Dart classes modeling Intro, HomeSections, Users, Devices, Requests, Reviews, etc.)
4. Data/Service Layer
– utils/Authentication firebase (firebase_auth.dart)
– utils/pickImage.dart, utils/storeImg.dart
- Encapsulates communication with Firebase Auth, Storage, possibly Firestore or Realtime DB if added.
D. Assets & Config
– pubspec.yaml, pubspec.lock
– images/ (Lottie JSON animations, AVIF files)
– android/app/google-services.json, ios/Runner/GoogleService-Info.plist (config for Firebase).
E. Tests
– test/widget_test.dart

##### Interactions and Data Flow
- User taps UI widget → Presentation Layer invokes Provider method → Provider calls Service Layer → Service Layer interacts with Firebase Auth / Storage → Firebase returns response → Provider updates Model → Provider notifies Presentation Layer → UI re-renders.
- Images and animations are loaded locally from the assets/images folder.
- Platform embedders bootstrap Flutter Engine, load main.dart and handle plugin registration (generated_plugin_registrant.*).

##### Architectural Patterns & Principles
- Layered Architecture (Presentation → State Management → Domain → Data Services).
- Modular by Feature (separate directories for Medical Devices, Nurse Centers, Profile, etc.).
- Single Source of Truth via Provider.
- Use of Flutter’s plugin system to integrate with Firebase and native APIs.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Platform Embedders
    subgraph "Platform Embedders"
        direction TB
        Android["Android"]:::native
        iOS["iOS"]:::native
        Web["Web"]:::native
        Windows["Windows"]:::native
        macOS["macOS"]:::native
        Linux["Linux"]:::native
    end

    %% Flutter Engine & Dart VM
    Engine["Flutter Engine & Dart VM\n(lib/main.dart)"]:::engine

    %% Application Layers
    subgraph "Application Layers"
        direction TB
        subgraph "Presentation Layer"
            direction TB
            Widgets["Widgets\n(lib/widgets)"]:::presentation
            Sections["Feature Sections\n(lib/sections)"]:::presentation
            Screens["Screens & Pages\n(lib/)"]:::presentation
        end
        StateMgmt["State Management\n(lib/provider/myprovider.dart)"]:::state
        Domain["Domain/Model\n(lib/model)"]:::domain
        DataServices["Data/Service\n(lib/utils)"]:::data
    end

    %% External Services
    subgraph "External Services"
        direction TB
        FirebaseAuth["Firebase Auth"]:::external
        FirebaseStorage["Firebase Storage"]:::external
        Firestore["Firestore"]:::external
    end

    %% Assets & Config
    subgraph "Assets & Config"
        direction TB
        Pubspec["pubspec.yaml\npubspec.lock"]:::assets
        Images["images/"]:::assets
        AndroidConfig["Android Firebase Config"]:::assets
        iOSConfig["iOS Firebase Config"]:::assets
    end

    %% Tests
    Test["Widget Tests\ntest/widget_test.dart"]:::tests

    %% Connections
    Android -->|bootstrap| Engine
    iOS -->|bootstrap| Engine
    Web -->|bootstrap| Engine
    Windows -->|bootstrap| Engine
    macOS -->|bootstrap| Engine
    Linux -->|bootstrap| Engine

    Engine -->|runs main.dart| Widgets
    Widgets -->|user action| StateMgmt
    Sections -->|user action| StateMgmt
    Screens -->|user action| StateMgmt

    StateMgmt -->|uses models| Domain
    Domain -->|accesses| DataServices
    DataServices -->|auth/storage calls| FirebaseAuth
    DataServices -->|storage calls| FirebaseStorage
    DataServices -->|db calls| Firestore

    FirebaseAuth -->|response| StateMgmt
    FirebaseStorage -->|response| StateMgmt
    Firestore -->|response| StateMgmt

    Widgets <-->|notifyListeners| StateMgmt
    Pubspec -->|assets defined| Widgets
    Images -->|loaded by| Widgets
    AndroidConfig -.->|config| FirebaseAuth
    iOSConfig -.->|config| FirebaseAuth
    Test -->|tests UI| Widgets

    %% Click Events
    click Android "https://github.com/qutaibaqusai/heartful-care/tree/main/android/"
    click iOS "https://github.com/qutaibaqusai/heartful-care/tree/main/ios/"
    click Web "https://github.com/qutaibaqusai/heartful-care/tree/main/web/"
    click Windows "https://github.com/qutaibaqusai/heartful-care/tree/main/windows/"
    click macOS "https://github.com/qutaibaqusai/heartful-care/tree/main/macos/"
    click Linux "https://github.com/qutaibaqusai/heartful-care/tree/main/linux/"
    click Engine "https://github.com/qutaibaqusai/heartful-care/blob/main/lib/main.dart"
    click MainActivity "https://github.com/qutaibaqusai/heartful-care/blob/main/android/app/src/main/kotlin/com/example/test/MainActivity.kt"
    click IosRegistrant "https://github.com/qutaibaqusai/heartful-care/blob/main/ios/Runner/GeneratedPluginRegistrant.swift"
    click LinuxRegistrant "https://github.com/qutaibaqusai/heartful-care/blob/main/linux/flutter/generated_plugin_registrant.cc"
    click MacRegistrant "https://github.com/qutaibaqusai/heartful-care/blob/main/macos/Flutter/GeneratedPluginRegistrant.swift"
    click WinRegistrant "https://github.com/qutaibaqusai/heartful-care/blob/main/windows/flutter/generated_plugin_registrant.cc"
    click ImageSelector "https://github.com/qutaibaqusai/heartful-care/blob/main/lib/widgets/image_selector.dart"
    click SubscriptionCard "https://github.com/qutaibaqusai/heartful-care/blob/main/lib/widgets/widget_subscription_plan_card.dart"
    click Sections "https://github.com/qutaibaqusai/heartful-care/tree/main/lib/sections/"
    click LoginScreen "https://github.com/qutaibaqusai/heartful-care/blob/main/lib/User login-Sginup/login_screen.dart"
    click SignupScreen "https://github.com/qutaibaqusai/heartful-care/blob/main/lib/User login-Sginup/signup_screen.dart"
    click MyProvider "https://github.com/qutaibaqusai/heartful-care/blob/main/lib/provider/myprovider.dart"
    click Model "https://github.com/qutaibaqusai/heartful-care/tree/main/lib/model/"
    click FirebaseAuthUtil "https://github.com/qutaibaqusai/heartful-care/blob/main/lib/utils/Authentication firebase/firebase_auth.dart"
    click PickImage "https://github.com/qutaibaqusai/heartful-care/blob/main/lib/utils/pickImage.dart"
    click StoreImg "https://github.com/qutaibaqusai/heartful-care/blob/main/lib/utils/storeImg.dart"
    click Pubspec "https://github.com/qutaibaqusai/heartful-care/blob/main/pubspec.yaml"
    click Images "https://github.com/qutaibaqusai/heartful-care/tree/main/images/"
    click AndroidConfig "https://github.com/qutaibaqusai/heartful-care/blob/main/android/app/google-services.json"
    click iOSConfig "https://github.com/qutaibaqusai/heartful-care/blob/main/ios/Runner/GoogleService-Info.plist"
    click WidgetTest "https://github.com/qutaibaqusai/heartful-care/blob/main/test/widget_test.dart"

    %% Styles
    classDef native fill:#D0E6FF,stroke:#0366D6,stroke-width:1px;
    classDef engine fill:#E0E0E0,stroke:#888888,stroke-width:1px;
    classDef presentation fill:#DFF7DF,stroke:#2E8B57,stroke-width:1px,stroke-dasharray: 5 5;
    classDef state fill:#FFE5B4,stroke:#FF8C00,stroke-width:1px;
    classDef domain fill:#FFF4D6,stroke:#DAA520,stroke-width:1px;
    classDef data fill:#E8D0F8,stroke:#800080,stroke-width:1px;
    classDef external fill:#D0FFFF,stroke:#20B2AA,stroke-width:1px,stroke-dasharray: 2 2;
    classDef assets fill:#F0F0F0,stroke:#A9A9A9,stroke-width:1px;
    classDef tests fill:#FFE4E1,stroke:#FF1493,stroke-width:1px;
```
