How danielra62/cancer_esofago_app works
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: prediction_viewmodel.dart Prediction VM · app.dart app.dart · menu.dart Menu · auth_viewmodel.dart Auth VM
Components 21
Flutter app
Shared Dart application code and architecture
- main.dart · Flutter app bootstrap
lib/main.dart - app.dart · Top-level app wiring, navigation, theme
lib/app.dart - Login · Authentication screen
lib/screens/login.dart - Register · User sign-up screen
lib/screens/registrar.dart - Welcome · Landing or welcome screen
lib/screens/Bienvenido.dart - Menu · Post-login navigation hub
lib/screens/menu.dart - Edit profile · Profile editing screen
lib/screens/editar_perfil.dart - History · Prediction history screen
lib/screens/historial.dart - Results · Prediction results screen
lib/screens/resultados.dart - Prediction · Prediction workflow screen
lib/screens/prediccion/prediccion_screen.dart - Auth VM · Authentication state and actions
lib/viewmodels/auth_viewmodel.dart - Prediction VM · Prediction workflow state orchestration
lib/viewmodels/prediction_viewmodel.dart - Auth service · Authentication integration logic
lib/services/auth_service.dart - Prediction service · Prediction API or backend integration
lib/services/prediction_service.dart - User · Shared user data model
lib/models/user.dart - Prediction history · Stored prediction record model
lib/models/prediction_history.dart - App config · Central app configuration values
lib/config/app_config.dart
Android host
Native Android wrapper and build files
- MainActivity · Android Flutter entry activity
android/app/src/main/kotlin/com/example/untitled/MainActivity.kt - Plugins · Generated Android plugin registrant
android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
Web host
Browser bootstrap and web assets
- Web index · Browser bootstrap page
web/index.html - Web manifest · PWA manifest and icons config
web/manifest.json
Connections 23
- 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