# shreemanarjun/flutter_sharez architecture

> Architecture diagram of the GitHub repository shreemanarjun/flutter_sharez, 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/shreemanarjun/flutter_sharez
- Repository: https://github.com/shreemanarjun/flutter_sharez

## Overview

##### Project Type & Purpose
- Flutter Sharez is a multi-platform mobile/desktop/web application built using Flutter.
- Its primary purpose is to enable file sharing between various devices through sender and receiver functionalities.
- It uses Riverpod for state management, AutoRoute for navigation, and integrates several packages for networking (dio), storage (hive_flutter), and more.

##### File Structure
- Top-Level Platform Directories: Notice separate directories for android, ios, macos, and web. These represent how the Flutter project is configured to run on different platforms.
- lib Directory: This is the heart of the application. It is organized into subdirectories:
- app and shared: Core application bootstrap and shared widgets/components.
- core: Contains foundational modules such as local_storage, routing (including auto_route configuration), theming, and global helper utilities.
- data: Contains models for file handling, server info, and services categorized into sender and receiver functionalities.
- features: Divided into individual modules (confirm_connection, counter, device_share, downloads, file_selector, receive, send, settings, update_app_version, etc.) each encapsulating a particular functional area with its own controller, view, state and sometimes service integration.
- Additional Directories: Testing, configuration files (pubspec.yaml, analysis_options.yaml), GitHub workflows, and localization assets (l10n) that provide further structure and tooling support.

##### Key Architectural Components to Capture
a. UI / Presentation Layer:
- Visual Components & Screens: Represented by the "features" directory, including screens for sending/receiving files, home, settings, dialogs, etc.
- Navigation: Managed through auto_route in the core/router folder.
- Theme & Localization: Handled by core/theme and l10n folders.
b. Business Logic / State Management:
- Riverpod Providers: Distributed throughout the project in feature-specific state management (e.g., counter, file downloads, selected file state, connectivity) and in shared pods.
- Controllers/Notifiers: Found within various features that define interaction logic.
c. Data Layer:
- Models: Under lib/data/model showing file models, server models, update models, etc.
- Services: Separated into sender and receiver services that encapsulate file transfer logic.
- Network & API Clients: In the shared/api_client directory, handling HTTP communication via packages like dio.
- Local Storage: Provided under core/local_storage using implementations like Hive.
d. Platform Abstraction:
- Specific configurations and platform-dependent files for Android, iOS, macos, and web ensuring native integration.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External / User
    U["User"]:::external

    %% Presentation Layer
    subgraph "Presentation Layer"
        FUI["Features (UI)"]:::presentation
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        FCP["Feature Controllers & Providers"]:::business
    end

    %% Data Layer
    subgraph "Data Layer"
        DM["Data Models"]:::data
        SS["Sender Service"]:::data
        RS["Receiver Service"]:::data
        AC["API Client"]:::data
        LS["Local Storage"]:::data
    end

    %% Core Utilities
    subgraph "Core Utilities"
        NAV["Navigation (AutoRoute)"]:::core
        TH["Theme"]:::core
        LOC["Localization"]:::core
    end

    %% Platform Configurations
    subgraph "Platform Configurations"
        ANDR["Android"]:::platform
        IOS["iOS"]:::platform
        MAC["macOS"]:::platform
        WEB["Web"]:::platform
    end

    %% Connections
    U -->|"interacts"| FUI
    FUI -->|"triggers"| FCP
    FCP -->|"processes"| DM
    FCP -->|"calls"| SS
    FCP -->|"calls"| RS
    SS -->|"uses"| AC
    RS -->|"uses"| AC
    AC -->|"returns"| FCP
    FCP -->|"updates"| FUI
    FUI -->|"navigates"| NAV
    FUI -->|"styledBy"| TH
    FUI -->|"localizedBy"| LOC
    FCP -->|"accesses"| LS

    %% Core Utilities to Platform
    NAV -->|"platformSpecific"| ANDR
    NAV -->|"platformSpecific"| IOS
    NAV -->|"platformSpecific"| MAC
    NAV -->|"platformSpecific"| WEB

    %% Styles
    classDef external fill:#FFFFE0,stroke:#000,stroke-width:2px;
    classDef presentation fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef business fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef data fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef core fill:#E6E6FA,stroke:#000,stroke-width:2px;
    classDef platform fill:#D3D3D3,stroke:#000,stroke-width:2px;

    %% Click Events
    click FUI "https://github.com/shreemanarjun/flutter_sharez/tree/main/lib/features"
    click NAV "https://github.com/shreemanarjun/flutter_sharez/tree/main/lib/core/router"
    click TH "https://github.com/shreemanarjun/flutter_sharez/tree/main/lib/core/theme"
    click LOC "https://github.com/shreemanarjun/flutter_sharez/tree/main/lib/l10n"
    click FCP "https://github.com/shreemanarjun/flutter_sharez/tree/main/lib/features/counter/controller"
    click DM "https://github.com/shreemanarjun/flutter_sharez/tree/main/lib/data/model"
    click SS "https://github.com/shreemanarjun/flutter_sharez/tree/main/lib/data/service/sender"
    click RS "https://github.com/shreemanarjun/flutter_sharez/tree/main/lib/data/service/receiver"
    click AC "https://github.com/shreemanarjun/flutter_sharez/tree/main/lib/shared/api_client"
    click LS "https://github.com/shreemanarjun/flutter_sharez/tree/main/lib/core/local_storage"
    click ANDR "https://github.com/shreemanarjun/flutter_sharez/tree/main/android"
    click IOS "https://github.com/shreemanarjun/flutter_sharez/tree/main/ios"
    click MAC "https://github.com/shreemanarjun/flutter_sharez/tree/main/macos"
    click WEB "https://github.com/shreemanarjun/flutter_sharez/tree/main/web"
```
