How priyank-0401/flextime works
Project Type and Purpose
• This is a cross‐platform Flutter application (“flextime_app”) that runs on Android, iOS, Web, and Windows.
• It is structured using a Clean Architecture / feature–driven approach: UI → Presentation → Domain → Data → Core services.
File Structure Highlights
• Top-level platform folders: android/, ios/, web/, windows/ (each holds platform embedder code).
• lib/ is the main Dart code:
• core/ – app-wide services, utils, theme, navigation, database setup
• features/ – two major feature sets (“dead_minutes” & “energy_planner”) and shared home, plan, settings
• main.dart – application entry point
• Each feature follows the layers: data/ (models, datasources, repos), domain/ (entities, repos interfaces, use cases), engine/ (business logic), presentation/ (UI pages, providers, widgets).
Key Components
a. Presentation Layer
• Flutter Widgets (Pages, Screens, Widgets)
• State Management / Providers
b. Domain Layer
• Use Cases (e.g., SuggestActivities, LogCompletion, TimelineGeneration)
• Entities & Repositories Interfaces
c. Data Layer
• Repository Implementations
• Local Data Sources (e.g., SQLite via app_database.dart & migrations)
• Models (DTOs / ORM objects)
d. Core Services
• DatabaseService (wraps Drift/Moor or sqflite)
• NotificationService (schedules OS notifications)
• Navigation (main_navigation.dart)
• Utilities & Error Handling
e. Platform/External
• Android, iOS, Web, Windows embedding layers
• OS Notifications, Local Storage (SQLite), Platform Channels
Interactions & Data Flows
• UI Widgets → Providers (presentation state) → Use Cases
• Use Cases → Repository Interfaces → RepositoryImpl
• RepositoryImpl → LocalDataSource → Core DatabaseService → SQLite
• Engine modules invoked by Use Cases or Providers to run business rules
• NotificationService triggered by engine or presentation to schedule OS notifications
• main.dart initializes Core (database, services) and hooks platform channels
Architectural Patterns & Principles
• Clean/Onion Architecture with strict layer dependence:
UI only knows Presentation; Presentation depends on Domain; Domain is independent; Data knows Domain interfaces; Core services are shared.
• Feature-based modularization to isolate “dead_minutes” vs “energy_planner.”
• Dependency Injection via service locators or Flutter providers.