How mandeep347/splito_flutter works
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: app.dart app.dart · network Network · data Auth data · presentation Auth UI
Components 18
App shell
Flutter entrypoint, root widget assembly, and platform targets.
Core infrastructure
Cross-cutting services for config, routing, theme, storage, network, logging, and errors.
- Env config · Environment loading for dev, staging, prod, and local .env.
config/env - Router · Named routes and app router setup.
lib/core/router - Theme system · Color schemes, typography, custom theme extensions, and theme state.
lib/core/theme - Storage · Hive and secure storage abstractions plus token storage.
lib/core/storage - Logging · Application logging and crash reporting.
lib/core/logger - Errors · Error mapping, exception models, failures, and centralized handlers.
lib/core/error - Network · Dio client, connectivity, retries, queues, auth, and logging interceptors.
lib/core/network
Features
Feature-first business capabilities built with layered clean architecture.
- Auth domain · Auth entities, repository contract, and use cases.
lib/features/auth/domain - Auth data · Remote/local datasources, response models, and repository implementation.
lib/features/auth/data - Auth UI · Login and register pages, provider, and form wrapper.
lib/features/auth/presentation - Groups domain · Group entities, repository contract, and group management use cases.
lib/features/groups/domain - Groups data · Group remote/local datasources, models, and repository implementation.
lib/features/groups/data - Groups UI · Group pages, provider layer, and editing bottom sheets/widgets.
lib/features/groups/presentation - Profile use case · Profile update business rule.
lib/features/profile/domain - Profile UI · Profile page and provider state.
lib/features/profile/presentation
Shared UI
Reusable presentation components and widgets used across features.
- Shared UI kit · Reusable buttons, cards, chips, dialogs, loaders, inputs, and common widgets.
lib/shared
Connections 25
- 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.