# farhanriaaz/secondopinionapp architecture

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

## Overview

##### Project type and purpose
- This is a cross-platform Flutter application (mobile, web, desktop) named “second_opinion_app.”
- It serves as a client for a “second opinion” medical service, providing screens for authentication, browsing categories, uploading reports, making payments, chatting, etc.

##### File structure
- Top-level folders:
- android, ios, linux, macos, windows, web – platform-specific wrappers and build files
- lib – Dart code implementing the app’s architecture
- assets – static resources (fonts, images, localization JSONs)
- pubspec.yaml – dependency and asset declarations
- Within lib:
- constants – theme, asset paths, strings
- data – repository pattern with network (Dio/REST client) and local datasource layers
- di – dependency injection (get_it via service_locator, network_module, local_module)
- models – data transfer objects for authentication, categories, posts, profiles, reports, sliders
- stores – MobX state-management stores (one per feature, with generated code)
- ui – Flutter screens (login, registration, home, categories, second opinion workflow, reports, profile, support)
- utils – helper classes (device utils, Dio error handling, encryption, localization, routing)
- widgets – reusable UI components
- Key configurations:
- firebase_options.dart + google-services.json / GoogleService-Info.plist for Firebase integration
- flutter_native_splash.yaml for splash screen setup

## Diagram (Mermaid)

```mermaid
graph TB
    %% Platform Shells
    Platforms["Platform Shells\n(android/, ios/, web/, linux/, macos/, windows/)"]:::platform

    %% Main Entry Point
    Main["Main Entry Point\nlib/main.dart"]:::main

    %% Presentation Layer
    subgraph "Presentation Layer"
        UI["UI Widgets & Screens\n(lib/ui)"]:::ui
        Widgets["Reusable UI Components\n(lib/widgets)"]:::ui
    end

    %% State Management Layer
    subgraph "State Management Layer"
        Stores["MobX Stores\n(lib/stores)"]:::state
    end

    %% Domain & Repository Layer
    subgraph "Domain & Repository Layer"
        Repo["Repositories\n(lib/data/repository)"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        subgraph "Network DataSource"
            Dio["DioClient\n(dio_client.dart)"]:::data
            RestCl["RestClient\n(rest_client.dart)"]:::data
            APIs["API Definitions\n(apis/)"]:::data
        end
        subgraph "Local DataSource"
            SP["SharedPreferenceHelper\n(sharedpref/shared_preference_helper.dart)"]:::data
            DBConst["DB Constants\n(constants/db_constants.dart)"]:::data
        end
    end

    %% Dependency Injection
    subgraph "Dependency Injection Container"
        SL["Service Locator\n(components/service_locator.dart)"]:::di
        NetMod["Network Module\n(module/network_module.dart)"]:::di
        LocMod["Local Module\n(module/local_module.dart)"]:::di
    end

    %% Supporting Components
    Models["Models\n(lib/models)"]:::util
    Utils["Utilities\n(lib/utils)"]:::util
    Assets["Assets & Localization\n(assets/ , flutter_native_splash.yaml)"]:::assets
    FirebaseCfg["Firebase Configuration\n(lib/firebase_options.dart)"]:::external
    REST["REST API Backend"]:::external
    FirebaseSvc["Firebase Services"]:::external

    %% Connections
    Platforms --> Main
    Main --> UI
    Main --> SL
    UI --> Stores
    UI --> Widgets
    UI --> Utils
    UI --> Models
    Stores --> Repo
    Stores --> Models
    Repo --> Dio
    Repo --> SP
    Repo --> DBConst
    Dio --> REST
    RestCl --> REST
    APIs --> REST
    SP --> DBConst
    SL --> Repo
    SL --> Dio
    SL --> SP
    NetMod --> Dio
    LocMod --> SP
    FirebaseCfg --> FirebaseSvc

    %% Click Events
    click UI "https://github.com/farhanriaaz/secondopinionapp/tree/main/lib/ui"
    click Widgets "https://github.com/farhanriaaz/secondopinionapp/tree/main/lib/widgets"
    click Stores "https://github.com/farhanriaaz/secondopinionapp/tree/main/lib/stores"
    click Repo "https://github.com/farhanriaaz/secondopinionapp/tree/main/lib/data/repository"
    click Dio "https://github.com/farhanriaaz/secondopinionapp/blob/main/lib/data/network/dio_client.dart"
    click RestCl "https://github.com/farhanriaaz/secondopinionapp/blob/main/lib/data/network/rest_client.dart"
    click APIs "https://github.com/farhanriaaz/secondopinionapp/tree/main/lib/data/network/apis"
    click SP "https://github.com/farhanriaaz/secondopinionapp/blob/main/lib/data/sharedpref/shared_preference_helper.dart"
    click DBConst "https://github.com/farhanriaaz/secondopinionapp/blob/main/lib/data/local/constants/db_constants.dart"
    click SL "https://github.com/farhanriaaz/secondopinionapp/blob/main/lib/di/components/service_locator.dart"
    click NetMod "https://github.com/farhanriaaz/secondopinionapp/blob/main/lib/di/module/network_module.dart"
    click LocMod "https://github.com/farhanriaaz/secondopinionapp/blob/main/lib/di/module/local_module.dart"
    click Models "https://github.com/farhanriaaz/secondopinionapp/tree/main/lib/models"
    click Utils "https://github.com/farhanriaaz/secondopinionapp/tree/main/lib/utils"
    click Assets "https://github.com/farhanriaaz/secondopinionapp/tree/main/assets/"
    click FirebaseCfg "https://github.com/farhanriaaz/secondopinionapp/blob/main/lib/firebase_options.dart"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0288D1,stroke-width:2px
    classDef state fill:#E8F5E9,stroke:#43A047,stroke-width:2px
    classDef domain fill:#FFF3E0,stroke:#FB8C00,stroke-width:2px
    classDef data fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px
    classDef di fill:#E1BEE7,stroke:#8E24AA,stroke-width:2px
    classDef util fill:#CFD8DC,stroke:#546E7A,stroke-width:2px
    classDef assets fill:#FBE9E7,stroke:#D84315,stroke-width:2px
    classDef external fill:#FFEBEE,stroke:#E53935,stroke-width:2px
    classDef platform fill:#E0F7FA,stroke:#00838F,stroke-width:2px
    classDef main fill:#ECEFF1,stroke:#37474F,stroke-width:2px
```
