How vborbely/todo_sample works
Overall Project Type and Purpose
• This is a Flutter-based ToDo application sample, aimed at demonstrating basic state management (using bloc), local & secure storage (using hive and flutter_secure_storage), and routing (via go_router).
• The project supports multiple platforms: Web, Android, iOS, macOS, Linux, and Windows.
Main Architectural Components
– Entry Point & App Bootstrap:
• lib/main.dart initializes the Flutter application.
• Environment configuration is set via the environment files (env.dev, env.mock, env.production, env.staging, env.template).
– Application Layer (Application Domain):
• Located in lib/application (with subdirectories for config, errors, and utils).
• Handles global configuration constants, environment configurations, and logging.
– Data Layer:
• Contains subdirectories for cubits (state management using bloc), entities (data models along with Hive adaptations), repositories (data access abstraction), and services (e.g., storage service).
• This layer defines how data is processed, stored (Hive, secure storage), and provided to the rest of the application.
– Presentation Layer:
• Resides in lib/presentation and is further subdivided into screens like home, person, settings as well as shared widgets.
• Manages user interface components and interactions.
– External and Third-Party Libraries:
• bloc – for state management.
• flutter_secure_storage – for secure data storage.
• hive – for local persistence of entities.
• go_router – for handling navigation and routing.
Interactions & Data Flow
– The Flutter entry (main.dart) loads configurations from the Application layer.
– The Presentation layer (UI screens and widgets) communicates with state management controllers (cubits) in the Data layer.
– Cubits manage state changes and use repositories to fetch or persist data (using Hive over secure storage).
– Repositories encapsulate interactions with services (like the storage service) and data entities.
– Routing is managed by configuration from the Application layer (as seen in router.dart) using go_router.
Important Architectural Patterns
– Layered Architecture: Clear separation between presentation, application, and data management.
– State management using the BLoC pattern (cubits).
– Repository Pattern for abstracting data sources.
– Use of environment-based configurations, emphasizing flexibility across different platforms and build modes.