# danielra62/cancer_esofago_app architecture

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

- Interactive diagram: https://gitdiagram.com/danielra62/cancer_esofago_app
- Repository: https://github.com/danielra62/cancer_esofago_app

## Overview

1. **Project type and runtime**
   - This is a **Flutter application** targeting multiple platforms, with explicit Android and Web platform folders present.
   - The repo is organized as a typical Flutter client app rather than a backend service.

2. **Startup and composition root**
   - The app entry point is `lib/main.dart`, which likely initializes the Flutter app and hands off to `lib/app.dart`.
   - `app.dart` is the natural composition root for navigation, theming, and top-level wiring between UI and state layers.

3. **Presentation layer**
   - The UI is concentrated under `lib/screens/`.
   - Key screens include:
     - `login.dart`
     - `registrar.dart` for sign-up
     - `Bienvenido.dart` as a welcome/landing screen
     - `menu.dart` as a main navigation hub
     - `editar_perfil.dart`
     - `historial.dart`
     - `resultados.dart`
     - `prediccion/prediccion_screen.dart`
   - The names suggest the app is user-facing and workflow-driven, with login, prediction, results, and history as core user journeys.

4. **Feature boundaries**
   - The screens are grouped around two main features:
     - **Authentication and profile management**
     - **Prediction workflow and prediction history**
   - `menu.dart` appears to be the central post-login entry point that connects these areas.

5. **State / presentation logic**
   - `lib/viewmodels/` indicates a separation between UI and business/state logic.
   - `auth_viewmodel.dart` and `prediction_viewmodel.dart` likely mediate screen actions, loading states, and data transformation before the UI renders.
   - This suggests an MVVM-style structure, or at least a UI/viewmodel/service separation.

6. **Service layer**
   - `lib/services/` contains the app’s operational logic:
     - `auth_service.dart`
     - `prediction_service.dart`
   - These services likely encapsulate communication with external systems such as authentication endpoints or prediction APIs, keeping that logic out of widgets and screens.

7. **Domain models**
   - `lib/models/` holds the data structures used across the app:
     - `user.dart`
     - `prediction_history.dart`
   - These models define the app’s shared data boundary between services, viewmodels, and screens.

8. **Configuration and environment**
   - `lib/config/app_config.dart` centralizes app-level configuration.
   - In architecture terms, this is where environment-specific values, API base URLs, or feature toggles would typically be isolated.

9. **Platform integration**
   - The `android/` folder contains the native Android host app, including `MainActivity.kt` and the generated plugin registrant.
   - The `web/` folder contains the browser bootstrap (`index.html`, `manifest.json`, icons).
   - These folders are platform shells around the shared Flutter codebase, not separate business logic layers.

10. **Project-level structure and tooling**
   - `pubspec.yaml`, `analysis_options.yaml`, and `devtools_options.yaml` show standard Flutter/Dart tooling and linting setup.
   - The presence of Gradle/Kotlin files under `android/` reflects Flutter’s Android build pipeline rather than custom native architecture.

11. **Likely data flow**
   - A user action starts in a screen widget.
   - The screen calls into a viewmodel.
   - The viewmodel coordinates with a service.
   - The service retrieves or submits data, likely to an external backend or API.
   - Results are converted into model objects and then displayed back in the UI.
   - Prediction history and user state appear to be the main persistent application data handled through this flow.

12. **Diagram-friendly boundary summary**
   - Draw the app as four layers:
     - **Flutter UI/screens**
     - **Viewmodels/state orchestration**
     - **Services/integration logic**
     - **Models/configuration**
   - Surround those with the Flutter host/platform layer for Android and Web.
   - The key architectural seam is between the presentation/state layers and the service layer, where external communication is isolated.

Main entry points: [`lib/viewmodels/prediction_viewmodel.dart`](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/viewmodels/prediction_viewmodel.dart) (Prediction VM), [`lib/app.dart`](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/app.dart) (app.dart), [`lib/screens/menu.dart`](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/menu.dart) (Menu), [`lib/viewmodels/auth_viewmodel.dart`](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/viewmodels/auth_viewmodel.dart) (Auth VM)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g_flutter["Flutter app"]
  node_n_main(("main.dart<br/>entrypoint<br/>[main.dart]"))
  node_n_app["app.dart<br/>composition root<br/>[app.dart]"]
  node_n_login["Login<br/>screen<br/>[login.dart]"]
  node_n_register["Register<br/>screen<br/>[registrar.dart]"]
  node_n_welcome["Welcome<br/>screen<br/>[Bienvenido.dart]"]
  node_n_menu["Menu<br/>screen<br/>[menu.dart]"]
  node_n_profile["Edit profile<br/>screen<br/>[editar_perfil.dart]"]
  node_n_history["History<br/>screen<br/>[historial.dart]"]
  node_n_results["Results<br/>screen<br/>[resultados.dart]"]
  node_n_predict["Prediction<br/>screen"]
  node_n_auth_vm{{"Auth VM<br/>viewmodel"}}
  node_n_pred_vm{{"Prediction VM<br/>viewmodel"}}
  node_n_auth_service[("Auth service<br/>[auth_service.dart]")]
  node_n_pred_service[("Prediction service")]
  node_n_user["User<br/>model<br/>[user.dart]"]
  node_n_history_model["Prediction history<br/>model"]
  node_n_config["App config<br/>[app_config.dart]"]
end

subgraph group_g_android["Android host"]
  node_n_mainactivity["MainActivity<br/>native host<br/>[MainActivity.kt]"]
  node_n_plugin_reg["Plugins<br/>native host"]
end

subgraph group_g_web["Web host"]
  node_n_web_index["Web index<br/>web bootstrap<br/>[index.html]"]
  node_n_web_manifest["Web manifest<br/>web asset<br/>[manifest.json]"]
end

node_n_main -->|"starts"| node_n_app
node_n_app -->|"routes to"| node_n_welcome
node_n_app -->|"routes to"| node_n_login
node_n_app -->|"routes to"| node_n_menu
node_n_login -->|"uses"| node_n_auth_vm
node_n_register -->|"uses"| node_n_auth_vm
node_n_profile -->|"uses"| node_n_auth_vm
node_n_auth_vm -->|"calls"| node_n_auth_service
node_n_auth_service -->|"returns"| node_n_user
node_n_menu -->|"opens"| node_n_profile
node_n_menu -->|"opens"| node_n_predict
node_n_menu -->|"opens"| node_n_history
node_n_predict -->|"uses"| node_n_pred_vm
node_n_results -->|"uses"| node_n_pred_vm
node_n_history -->|"uses"| node_n_pred_vm
node_n_pred_vm -->|"calls"| node_n_pred_service
node_n_pred_service -->|"returns"| node_n_history_model
node_n_pred_vm -->|"reads"| node_n_config
node_n_auth_service -->|"reads"| node_n_config
node_n_mainactivity -->|"hosts"| node_n_main
node_n_plugin_reg -->|"supports"| node_n_mainactivity
node_n_web_index -->|"boots"| node_n_main
node_n_web_manifest -->|"configures"| node_n_web_index

click node_n_main "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/main.dart"
click node_n_app "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/app.dart"
click node_n_login "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/login.dart"
click node_n_register "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/registrar.dart"
click node_n_welcome "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/Bienvenido.dart"
click node_n_menu "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/menu.dart"
click node_n_profile "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/editar_perfil.dart"
click node_n_history "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/historial.dart"
click node_n_results "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/resultados.dart"
click node_n_predict "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/prediccion/prediccion_screen.dart"
click node_n_auth_vm "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/viewmodels/auth_viewmodel.dart"
click node_n_pred_vm "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/viewmodels/prediction_viewmodel.dart"
click node_n_auth_service "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/services/auth_service.dart"
click node_n_pred_service "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/services/prediction_service.dart"
click node_n_user "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/models/user.dart"
click node_n_history_model "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/models/prediction_history.dart"
click node_n_config "https://github.com/danielra62/cancer_esofago_app/blob/main/lib/config/app_config.dart"
click node_n_mainactivity "https://github.com/danielra62/cancer_esofago_app/blob/main/android/app/src/main/kotlin/com/example/untitled/MainActivity.kt"
click node_n_plugin_reg "https://github.com/danielra62/cancer_esofago_app/blob/main/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java"
click node_n_web_index "https://github.com/danielra62/cancer_esofago_app/blob/main/web/index.html"
click node_n_web_manifest "https://github.com/danielra62/cancer_esofago_app/blob/main/web/manifest.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_n_main,node_n_app,node_n_login,node_n_register,node_n_welcome,node_n_menu,node_n_profile,node_n_history,node_n_results,node_n_predict,node_n_auth_vm,node_n_pred_vm,node_n_auth_service,node_n_pred_service,node_n_user,node_n_history_model,node_n_config toneBlue
class node_n_mainactivity,node_n_plugin_reg toneAmber
class node_n_web_index,node_n_web_manifest toneMint
```

## Components

### Flutter app

Shared Dart application code and architecture

- [main.dart](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/main.dart): entrypoint · Flutter app bootstrap · `lib/main.dart`
- [app.dart](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/app.dart): composition root · Top-level app wiring, navigation, theme · `lib/app.dart`
- [Login](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/login.dart): screen · Authentication screen · `lib/screens/login.dart`
- [Register](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/registrar.dart): screen · User sign-up screen · `lib/screens/registrar.dart`
- [Welcome](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/Bienvenido.dart): screen · Landing or welcome screen · `lib/screens/Bienvenido.dart`
- [Menu](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/menu.dart): screen · Post-login navigation hub · `lib/screens/menu.dart`
- [Edit profile](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/editar_perfil.dart): screen · Profile editing screen · `lib/screens/editar_perfil.dart`
- [History](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/historial.dart): screen · Prediction history screen · `lib/screens/historial.dart`
- [Results](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/resultados.dart): screen · Prediction results screen · `lib/screens/resultados.dart`
- [Prediction](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/screens/prediccion/prediccion_screen.dart): screen · Prediction workflow screen · `lib/screens/prediccion/prediccion_screen.dart`
- [Auth VM](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/viewmodels/auth_viewmodel.dart): viewmodel · Authentication state and actions · `lib/viewmodels/auth_viewmodel.dart`
- [Prediction VM](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/viewmodels/prediction_viewmodel.dart): viewmodel · Prediction workflow state orchestration · `lib/viewmodels/prediction_viewmodel.dart`
- [Auth service](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/services/auth_service.dart): service · Authentication integration logic · `lib/services/auth_service.dart`
- [Prediction service](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/services/prediction_service.dart): service · Prediction API or backend integration · `lib/services/prediction_service.dart`
- [User](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/models/user.dart): model · Shared user data model · `lib/models/user.dart`
- [Prediction history](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/models/prediction_history.dart): model · Stored prediction record model · `lib/models/prediction_history.dart`
- [App config](https://github.com/danielra62/cancer_esofago_app/blob/main/lib/config/app_config.dart): config · Central app configuration values · `lib/config/app_config.dart`

### Android host

Native Android wrapper and build files

- [MainActivity](https://github.com/danielra62/cancer_esofago_app/blob/main/android/app/src/main/kotlin/com/example/untitled/MainActivity.kt): native host · Android Flutter entry activity · `android/app/src/main/kotlin/com/example/untitled/MainActivity.kt`
- [Plugins](https://github.com/danielra62/cancer_esofago_app/blob/main/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java): native host · Generated Android plugin registrant · `android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java`

### Web host

Browser bootstrap and web assets

- [Web index](https://github.com/danielra62/cancer_esofago_app/blob/main/web/index.html): web bootstrap · Browser bootstrap page · `web/index.html`
- [Web manifest](https://github.com/danielra62/cancer_esofago_app/blob/main/web/manifest.json): web asset · PWA manifest and icons config · `web/manifest.json`

## Connections

- main.dart → app.dart: starts · App entry initializes top-level composition
- app.dart → Welcome: routes to · Initial or landing screen
- app.dart → Login: routes to · Authentication flow
- app.dart → Menu: routes to · Primary in-app hub
- Login → Auth VM: uses · Delegates login actions and state
- Register → Auth VM: uses · Delegates sign-up actions and state
- Edit profile → Auth VM: uses · Profile updates through auth state
- Auth VM → Auth service: calls · Authentication operations
- Auth service → User: returns · Builds user domain objects
- Menu → Edit profile: opens · Profile management entry
- Menu → Prediction: opens · Prediction workflow entry
- Menu → History: opens · History browsing entry
- Prediction → Prediction VM: uses · Prediction workflow state and actions
- Results → Prediction VM: uses · Displays prediction outcome state
- History → Prediction VM: uses · Reads historical prediction state
- Prediction VM → Prediction service: calls · Prediction execution or lookup
- Prediction service → Prediction history: returns · Produces prediction history records
- Prediction VM → App config: reads · Uses app-level configuration
- Auth service → App config: reads · Uses app-level configuration
- MainActivity → main.dart: hosts · Android host starts Flutter app
- Plugins → MainActivity: supports · Registers platform plugins
- Web index → main.dart: boots · Web host loads Flutter app
- Web manifest → Web index: configures · PWA metadata and icons
