# sucodelarangela/tech-challenge-flutter architecture

> Architecture diagram of the GitHub repository sucodelarangela/tech-challenge-flutter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sucodelarangela/tech-challenge-flutter
- Repository: https://github.com/sucodelarangela/tech-challenge-flutter

## Overview

##### Project type and purpose
- This is a cross-platform mobile (and web/desktop) financial management app built entirely in Flutter.
- It allows users to authenticate (via Firebase Auth), view/add/edit/delete financial transactions (stored in Firestore), and upload/download attachments (via Firebase Storage).

##### File structure
- Top-level “android/”, “ios/”, “macos/”, “linux/”, “windows/”, “web/” directories → native shells for Flutter.
- “lib/” → Dart application code, subdivided into:
- components/ (UI building blocks for filters)
- core/models/ (data schemas: AccountUser, Transaction, etc.)
- core/providers/ (state management: AuthProvider, TransactionProvider)
- core/services/ (Firebase integration: AuthService, TransactionService)
- screens/ (main pages: Splash, Login, Home, Transactions, Form)
- widgets/ (reusable UI widgets)
- utils/ (helper functions and routing)
- assets/ → fonts, images.
- pubspec.* → dependency configuration.

##### Key README insights
- Uses Provider for state management.
- Relies on Firebase (Auth, Firestore, Storage).
- Includes common UI libraries (flutter_slidable, loader_overlay), media plugins (image_picker, compress, gallery_saver), networking (dio), and utilities (intl, uuid).

##### Main components of the system
a. Client (Flutter engine) running on each platform
b. UI Layer: Screens → Widgets → Components
c. State Layer: AuthProvider, TransactionProvider
d. Service Layer: AuthService, TransactionService
e. Data Models: account_user, transaction, user_balance, etc.
f. External Systems: Firebase Auth, Firestore DB, Cloud Storage
g. Native Plugins: Image Picker, Permissions, Dio

##### Relationships and interactions
- User taps UI → UI widget calls Provider method → Provider calls Service → Service invokes Firebase SDK → Firestore/Storage responds → Service returns data → Provider updates state → UI rebuilds.
- Image attachment flow: Widget → ImagePicker plugin → local file → Service.uploadToStorage → Storage URL → Firestore transaction document.

##### Architectural patterns and design principles
- Layered Architecture (UI / State / Services / External API)
- Provider pattern for unidirectional data flow (MVVM-like)
- Single codebase targeting multiple platforms (CI/CD flows compile to native shells)
- Separation of concerns: Models ↔ Services ↔ Providers ↔ UI

##### Relevant technologies/frameworks
- Flutter & Dart
- Provider (state management)
- Firebase Core, Auth, Firestore, Storage
- flutter_slidable, loader_overlay (UI)
- image_picker, flutter_image_compress, image_gallery_saver_plus
- dio, permission_handler
- intl, uuid, path (utilities)

##### Be very detailed
- Path of a transaction CRUD operation end-to-end.
- Error flows (AuthException model) where relevant.
- How filtering uses utils/filter_utils.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Native Shells / Deployment Targets
    subgraph "Deployment Targets"
        direction TB
        Android["Android"]:::shell
        iOS["iOS"]:::shell
        macOS["macOS"]:::shell
        Linux["Linux"]:::shell
        Windows["Windows"]:::shell
        Web["Web"]:::shell
    end

    %% Flutter App
    subgraph "Flutter App" 
        direction TB

        %% Entry Point
        Main["main.dart"]:::entry
        click Main "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/main.dart"

        %% Layers
        subgraph "UI Layer"
            direction TB
            Splash["SplashScreen"]:::ui
            click Splash "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/screens/splash_screen.dart"
            Login["LoginScreen"]:::ui
            click Login "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/screens/login_screen.dart"
            Home["HomeScreen"]:::ui
            click Home "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/screens/home_screen.dart"
            Transactions["TransactionsScreen"]:::ui
            click Transactions "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/screens/transactions_screen.dart"
            FormScreen["TransactionFormScreen"]:::ui
            click FormScreen "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/screens/transaction_form_screen.dart"

            subgraph "Filter Components"
                direction TB
                CategoryRadio["CategoryRadio"]:::ui
                click CategoryRadio "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/components/filter/category_radio.dart"
                FilterActions["FilterActions"]:::ui
                click FilterActions "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/components/filter/filter_actions.dart"
                FilterModal["FilterModal"]:::ui
                click FilterModal "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/components/filter/filter_modal.dart"
                MonthDropdown["MonthDropdown"]:::ui
                click MonthDropdown "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/components/filter/month_dropdown.dart"
            end

            subgraph "Widgets"
                direction TB
                AdaptDate["AdaptativeDatePicker"]:::ui
                click AdaptDate "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/widgets/adaptative_date_picker.dart"
                LoginForm["LoginForm"]:::ui
                click LoginForm "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/widgets/login_form.dart"
                Drawer["MainDrawer"]:::ui
                click Drawer "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/widgets/main_drawer.dart"
                MonthHeader["MonthHeader"]:::ui
                click MonthHeader "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/widgets/month_header.dart"
                TransactionItem["TransactionItem"]:::ui
                click TransactionItem "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/widgets/transaction_item.dart"
            end
        end

        subgraph "State Layer"
            direction TB
            AuthProv["AuthProvider"]:::state
            click AuthProv "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/core/providers/auth_provider.dart"
            TransProv["TransactionProvider"]:::state
            click TransProv "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/core/providers/transaction_provider.dart"
        end

        subgraph "Service Layer"
            direction TB
            AuthSvc["AuthService"]:::service
            click AuthSvc "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/core/services/auth_service.dart"
            TransSvc["TransactionService"]:::service
            click TransSvc "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/core/services/transaction_service.dart"
        end

        subgraph "Data Models"
            direction TB
            AccountUser["AccountUser"]:::model
            click AccountUser "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/core/models/account_user.dart"
            AuthException["AuthException"]:::model
            click AuthException "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/core/models/auth_exception.dart"
            TransactionModel["Transaction"]:::model
            click TransactionModel "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/core/models/transaction.dart"
            TransactionMode["TransactionMode"]:::model
            click TransactionMode "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/core/models/transaction_mode.dart"
            UserBalance["UserBalance"]:::model
            click UserBalance "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/core/models/user_balance.dart"
        end

        subgraph "Utilities"
            direction TB
            AppRoutes["AppRoutes"]:::util
            click AppRoutes "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/utils/app_routes.dart"
            Capitalize["Capitalize"]:::util
            click Capitalize "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/utils/capitalize.dart"
            FilterUtils["FilterUtils"]:::util
            click FilterUtils "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/utils/filter_utils.dart"
            TransHelpers["TransactionHelpers"]:::util
            click TransHelpers "https://github.com/sucodelarangela/tech-challenge-flutter/blob/main/lib/utils/transaction_helpers.dart"
        end

        Main --> UI_Layer[UI Layer]
        UI_Layer --> State_Layer[State Layer]
        State_Layer --> Service_Layer[Service Layer]
        Service_Layer --> Data_Models[Data Models]
        Service_Layer --> Utilities[Utilities]
    end

    %% External Systems
    subgraph "Firebase"
        direction TB
        AuthCloud["Auth"]:::cloud
        Firestore["Firestore"]:::cloud
        Storage["Storage"]:::cloud
    end

    %% Plugins
    subgraph "Native Plugins"
        direction TB
        ImagePicker["image_picker"]:::plugin
        Compress["flutter_image_compress"]:::plugin
        GallerySaver["image_gallery_saver_plus"]:::plugin
        Dio["dio"]:::plugin
        Permissions["permission_handler"]:::plugin
    end

    %% Data Flows
    UI_Layer -->|"calls"| State_Layer
    State_Layer -->|"invokes"| Service_Layer
    Service_Layer -->|"uses SDK"| Firebase
    Firebase -->|"returns data"| Service_Layer
    Service_Layer -->|"updates state"| State_Layer
    State_Layer -->|"rebuild UI"| UI_Layer

    TransactionItem -->|uploads image| ImagePicker
    ImagePicker -->|file| Service_Layer
    Service_Layer -->|upload| Storage
    Storage -->|URL| Service_Layer
    Service_Layer -->|store URL| Firestore

    %% Deployment arrow
    Android --> Main
    iOS --> Main
    macOS --> Main
    Linux --> Main
    Windows --> Main
    Web --> Main

    %% Styles
    classDef ui fill:#D0E6FF,stroke:#1C6EA4;
    classDef state fill:#DFF5D8,stroke:#2E7D32;
    classDef service fill:#FFE6CC,stroke:#E65100;
    classDef model fill:#F3E5F5,stroke:#6A1B9A;
    classDef util fill:#F0F0F0,stroke:#616161,stroke-dasharray: 5 5;
    classDef cloud fill:#E1F5FE,stroke:#0288D1,stroke-width:2;
    classDef plugin fill:#ECEFF1,stroke:#455A64,stroke-dasharray: 2 2;
    classDef entry fill:#FFF9C4,stroke:#F9A825,stroke-width:2;
    classDef shell fill:#CFD8DC,stroke:#607D8B;
```
