Project Structure
The project follows a Clean Architecture inspired structure with clear separation into app, core, and * features*.
lib/
app/ → app-wide modules (theme, router, DI, env)
router.dart → global routing (go_router)
theme.dart → app theme and styling
di.dart → dependency injection (providers, locator)
core/ → shared, generic & stable components
network/ → Dio client, interceptors
storage/ → secure/local storage abstractions
error/ → Failure, AppException, guards
utils/ → formatters, validators, helpers
result.dart → Either/Result type
modules/
inventory/
data/
models/ → DTOs (Json)
sources/ → remote/local data sources
repositories/ → implementations (InventoryRepositoryImpl)
domain/
entities/ → pure Dart objects (business entities)
repositories/ → abstract definitions (InventoryRepository)
usecases/ → business logic (AddItem, ScanBarcode, …)
presentation/
pages/
inventory_page.dart
add_item_page.dart
controllers/ → state management (Riverpod/BLoC) & presenters
widgets/ → feature-specific UI components
inventory_routes.dart → go_router routes for this feature
budget/ → same structure as inventory
expenses/ → same structure as inventory
auth/ → same structure as inventory
main.dart → application entry point
Layered Flow
Data Source → Repository Impl → Repository Abstraction → UseCase → Controller → UI (Pages/Widgets)