# mandeep347/splito_flutter architecture

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

- Interactive diagram: https://gitdiagram.com/mandeep347/splito_flutter
- Repository: https://github.com/mandeep347/splito_flutter

## Overview

1. This is a Flutter application organized as a feature-first, layered architecture. The main top-level boundaries are `core` for cross-cutting infrastructure, `features` for business capabilities, and `shared` for reusable UI building blocks.

2. App startup is centered around `lib/main.dart` and `lib/app.dart`, which likely assemble the root widget tree, theme, router, and dependency wiring. The app is configured to run across multiple Flutter targets: Android, web, and Windows are present in the repo.

3. `lib/core` holds platform- and app-wide services:
   - environment/config loading from `config/env` files (`dev.json`, `staging.json`, `prod.json`, plus `.env`)
   - routing (`app_router.dart`, `route_names.dart`)
   - theme system (`color_schemes`, `typography`, `theme_provider`, `theme_extensions`)
   - logging and crash reporting
   - storage abstractions over Hive and secure storage
   - network infrastructure built around Dio, with connectivity checking, request queuing, retries, auth, and logging interceptors
   - error mapping/handling and domain-friendly failure types

4. The network layer is a key architectural boundary. `dio_client.dart` and its interceptors form the HTTP gateway used by feature remote datasources. The presence of `session_invalidator` and `request_queue` suggests centralized handling for token expiry, offline/retry behavior, and serialized request recovery.

5. Authentication is a full vertical slice under `lib/features/auth`:
   - data layer: remote and local datasources, API response models, repository implementation
   - domain layer: entities, repository contract, and use cases for login/register/logout/get-me
   - presentation layer: login/register pages and an `auth_provider`
   Auth flows likely move from UI → provider → use case → repository → remote/local datasource → storage/network.

6. Group management is the richest domain slice and mirrors clean architecture closely:
   - data models for groups and members
   - remote/local datasources
   - repository implementation
   - domain entities and repository contract
   - many use cases for create/update/archive, membership management, and fetching lists/details
   - presentation pages for list/details/members plus providers and bottom-sheet widgets for editing actions
   This feature is probably the main business surface of the app.

7. Profile is a smaller feature slice with a page, provider, and an `update_profile_usecase`. It appears to depend on the shared auth/session context rather than having a full data stack of its own in this repo snapshot.

8. `lib/shared` contains reusable presentation components, not business logic. It provides themed atoms and molecules such as buttons, cards, chips, dialogs, loaders, inputs, avatars, bottom sheets, and common widgets like empty states, confirmation dialogs, error banners, loading overlays, and async-value wrappers. This keeps feature UIs thin and consistent.

9. State management is provider-based at the feature level. The naming (`auth_provider`, `group_providers`, `profile_provider`, `theme_provider`) suggests the UI reacts to notifier/provider state, while business rules stay in use cases and repositories. This is the main UI-to-domain bridge.

10. Persistence is split by concern: secure storage is used for sensitive data like tokens, Hive for local app data/cache, and token storage abstracts token handling across the app. That separation matters for the architecture diagram because auth/session state is not stored in one place.

11. The repository includes automated tests that mirror the feature layers: repository tests, use case tests, and provider tests. That indicates the architecture is designed for dependency inversion and isolated unit testing of domain and data logic.

12. There are some duplicated/parallel core error folders (`core/error` and `core/errors`) and network client paths, which suggests either an in-progress refactor or legacy structure preserved alongside newer code. For diagramming, treat error handling and networking as centralized cross-cutting infrastructure even if the folder names are slightly inconsistent.

Main entry points: [`lib/app.dart`](https://github.com/mandeep347/splito_flutter/blob/main/lib/app.dart) (app.dart), [`lib/core/network`](https://github.com/mandeep347/splito_flutter/tree/main/lib/core/network) (Network), [`lib/features/auth/data`](https://github.com/mandeep347/splito_flutter/tree/main/lib/features/auth/data) (Auth data), [`lib/features/auth/presentation`](https://github.com/mandeep347/splito_flutter/tree/main/lib/features/auth/presentation) (Auth UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell"]
  node_lib_main["main.dart<br/>entrypoint<br/>[main.dart]"]
  node_lib_app["app.dart<br/>root widget<br/>[app.dart]"]
end

subgraph group_core["Core infrastructure"]
  node_env_config["Env config"]
  node_core_router["Router<br/>navigation"]
  node_core_theme["Theme system<br/>ui theming"]
  node_core_storage[("Storage<br/>persistence")]
  node_core_logger["Logging<br/>observability"]
  node_core_errors["Errors<br/>error handling"]
  node_core_network["Network<br/>http gateway"]
end

subgraph group_features["Features"]
  node_auth_domain{{"Auth domain<br/>domain slice"}}
  node_auth_data["Auth data<br/>data slice"]
  node_auth_ui["Auth UI<br/>presentation slice"]
  node_groups_domain{{"Groups domain<br/>domain slice"}}
  node_groups_data["Groups data<br/>data slice"]
  node_groups_ui["Groups UI<br/>presentation slice"]
  node_profile_domain{{"Profile use case<br/>domain logic"}}
  node_profile_ui["Profile UI<br/>presentation slice"]
end

subgraph group_shared["Shared UI"]
  node_shared_ui["Shared UI kit<br/>design system"]
end

node_lib_main -->|"loads env"| node_env_config
node_lib_main -->|"boots"| node_lib_app
node_lib_app -->|"uses"| node_core_router
node_lib_app -->|"uses"| node_core_theme
node_lib_app -->|"initializes"| node_core_logger
node_lib_app -->|"wires"| node_core_errors
node_lib_app -->|"hosts"| node_auth_ui
node_lib_app -->|"hosts"| node_groups_ui
node_lib_app -->|"hosts"| node_profile_ui
node_core_network -->|"reads tokens"| node_core_storage
node_core_network -->|"maps failures"| node_core_errors
node_core_network -->|"logs"| node_core_logger
node_auth_ui -->|"calls use cases"| node_auth_domain
node_auth_domain -->|"depends on"| node_auth_data
node_auth_data -->|"uses http"| node_core_network
node_auth_data -->|"persists session"| node_core_storage
node_groups_ui -->|"calls use cases"| node_groups_domain
node_groups_domain -->|"depends on"| node_groups_data
node_groups_data -->|"uses http"| node_core_network
node_groups_data -->|"caches data"| node_core_storage
node_profile_ui -->|"updates via"| node_profile_domain
node_auth_ui -->|"reuses"| node_shared_ui
node_groups_ui -->|"reuses"| node_shared_ui
node_profile_ui -->|"reuses"| node_shared_ui
node_groups_domain -.->|"shares session"| node_auth_domain

click node_lib_main "https://github.com/mandeep347/splito_flutter/blob/main/lib/main.dart"
click node_lib_app "https://github.com/mandeep347/splito_flutter/blob/main/lib/app.dart"
click node_env_config "https://github.com/mandeep347/splito_flutter/tree/main/config/env"
click node_core_router "https://github.com/mandeep347/splito_flutter/tree/main/lib/core/router"
click node_core_theme "https://github.com/mandeep347/splito_flutter/tree/main/lib/core/theme"
click node_core_storage "https://github.com/mandeep347/splito_flutter/tree/main/lib/core/storage"
click node_core_logger "https://github.com/mandeep347/splito_flutter/tree/main/lib/core/logger"
click node_core_errors "https://github.com/mandeep347/splito_flutter/tree/main/lib/core/error"
click node_core_network "https://github.com/mandeep347/splito_flutter/tree/main/lib/core/network"
click node_auth_domain "https://github.com/mandeep347/splito_flutter/tree/main/lib/features/auth/domain"
click node_auth_data "https://github.com/mandeep347/splito_flutter/tree/main/lib/features/auth/data"
click node_auth_ui "https://github.com/mandeep347/splito_flutter/tree/main/lib/features/auth/presentation"
click node_groups_domain "https://github.com/mandeep347/splito_flutter/tree/main/lib/features/groups/domain"
click node_groups_data "https://github.com/mandeep347/splito_flutter/tree/main/lib/features/groups/data"
click node_groups_ui "https://github.com/mandeep347/splito_flutter/tree/main/lib/features/groups/presentation"
click node_profile_domain "https://github.com/mandeep347/splito_flutter/tree/main/lib/features/profile/domain"
click node_profile_ui "https://github.com/mandeep347/splito_flutter/tree/main/lib/features/profile/presentation"
click node_shared_ui "https://github.com/mandeep347/splito_flutter/tree/main/lib/shared"

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_lib_main,node_lib_app toneBlue
class node_env_config,node_core_router,node_core_theme,node_core_storage,node_core_logger,node_core_errors,node_core_network toneAmber
class node_auth_domain,node_auth_data,node_auth_ui,node_groups_domain,node_groups_data,node_groups_ui,node_profile_domain,node_profile_ui toneMint
class node_shared_ui toneRose
```

## Components

### App shell

Flutter entrypoint, root widget assembly, and platform targets.

- [main.dart](https://github.com/mandeep347/splito_flutter/blob/main/lib/main.dart): entrypoint · App bootstrap and startup wiring. · `lib/main.dart`
- [app.dart](https://github.com/mandeep347/splito_flutter/blob/main/lib/app.dart): root widget · Root app widget composition: theme, router, and providers. · `lib/app.dart`

### Core infrastructure

Cross-cutting services for config, routing, theme, storage, network, logging, and errors.

- [Env config](https://github.com/mandeep347/splito_flutter/tree/main/config/env): config · Environment loading for dev, staging, prod, and local .env. · `config/env`
- [Router](https://github.com/mandeep347/splito_flutter/tree/main/lib/core/router): navigation · Named routes and app router setup. · `lib/core/router`
- [Theme system](https://github.com/mandeep347/splito_flutter/tree/main/lib/core/theme): ui theming · Color schemes, typography, custom theme extensions, and theme state. · `lib/core/theme`
- [Storage](https://github.com/mandeep347/splito_flutter/tree/main/lib/core/storage): persistence · Hive and secure storage abstractions plus token storage. · `lib/core/storage`
- [Logging](https://github.com/mandeep347/splito_flutter/tree/main/lib/core/logger): observability · Application logging and crash reporting. · `lib/core/logger`
- [Errors](https://github.com/mandeep347/splito_flutter/tree/main/lib/core/error): error handling · Error mapping, exception models, failures, and centralized handlers. · `lib/core/error`
- [Network](https://github.com/mandeep347/splito_flutter/tree/main/lib/core/network): http gateway · Dio client, connectivity, retries, queues, auth, and logging interceptors. · `lib/core/network`

### Features

Feature-first business capabilities built with layered clean architecture.

- [Auth domain](https://github.com/mandeep347/splito_flutter/tree/main/lib/features/auth/domain): domain slice · Auth entities, repository contract, and use cases. · `lib/features/auth/domain`
- [Auth data](https://github.com/mandeep347/splito_flutter/tree/main/lib/features/auth/data): data slice · Remote/local datasources, response models, and repository implementation. · `lib/features/auth/data`
- [Auth UI](https://github.com/mandeep347/splito_flutter/tree/main/lib/features/auth/presentation): presentation slice · Login and register pages, provider, and form wrapper. · `lib/features/auth/presentation`
- [Groups domain](https://github.com/mandeep347/splito_flutter/tree/main/lib/features/groups/domain): domain slice · Group entities, repository contract, and group management use cases. · `lib/features/groups/domain`
- [Groups data](https://github.com/mandeep347/splito_flutter/tree/main/lib/features/groups/data): data slice · Group remote/local datasources, models, and repository implementation. · `lib/features/groups/data`
- [Groups UI](https://github.com/mandeep347/splito_flutter/tree/main/lib/features/groups/presentation): presentation slice · Group pages, provider layer, and editing bottom sheets/widgets. · `lib/features/groups/presentation`
- [Profile use case](https://github.com/mandeep347/splito_flutter/tree/main/lib/features/profile/domain): domain logic · Profile update business rule. · `lib/features/profile/domain`
- [Profile UI](https://github.com/mandeep347/splito_flutter/tree/main/lib/features/profile/presentation): presentation slice · Profile page and provider state. · `lib/features/profile/presentation`

### Shared UI

Reusable presentation components and widgets used across features.

- [Shared UI kit](https://github.com/mandeep347/splito_flutter/tree/main/lib/shared): design system · Reusable buttons, cards, chips, dialogs, loaders, inputs, and common widgets. · `lib/shared`

## Connections

- main.dart → Env config: loads env · Startup reads environment files before app construction.
- main.dart → app.dart: boots · Main initializes and runs the root app widget.
- app.dart → Router: uses · Root widget wires routing into the app shell.
- app.dart → Theme system: uses · Root widget applies theme state and design tokens.
- app.dart → Logging: initializes · App bootstrap connects logging and crash reporting.
- app.dart → Errors: wires · Global error handling is part of app composition.
- app.dart → Auth UI: hosts · Auth screens are mounted within the application shell.
- app.dart → Groups UI: hosts · Group management screens are mounted within the application shell.
- app.dart → Profile UI: hosts · Profile screen is mounted within the application shell.
- Network → Storage: reads tokens · HTTP auth and session handling depend on token storage.
- Network → Errors: maps failures · Network exceptions are normalized into app failures.
- Network → Logging: logs · Interceptors and client behavior emit logs.
- Auth UI → Auth domain: calls use cases · Provider and pages drive auth use cases.
- Auth domain → Auth data: depends on · Repository contract is fulfilled by the data layer.
- Auth data → Network: uses http · Remote auth calls go through the shared Dio gateway.
- Auth data → Storage: persists session · Auth data layer stores tokens and local session data.
- Groups UI → Groups domain: calls use cases · Group provider and pages drive group operations.
- Groups domain → Groups data: depends on · Group repository contract is implemented in data layer.
- Groups data → Network: uses http · Remote group operations use the shared network client.
- Groups data → Storage: caches data · Local group state and cache are persisted through storage.
- Profile UI → Profile use case: updates via · Profile provider triggers profile update logic.
- Auth UI → Shared UI kit: reuses · Auth screens use shared inputs, buttons, and wrappers.
- Groups UI → Shared UI kit: reuses · Group screens use shared sheets, cards, dialogs, and feedback widgets.
- Profile UI → Shared UI kit: reuses · Profile UI uses shared presentation primitives.
- Groups domain → Auth domain: shares session · Group flows likely rely on authenticated user/session context.
