How adhilkrishnag/focusflow works
FocusFlow is a Flutter cross-platform client application (Android/iOS/Web/Desktop) that provides:
• Task CRUD + categorization + priority
• Pomodoro timer
• Stats dashboard
• Theming (light/dark)
• Local notifications
• Local persistent storage using Hive (works on mobile + web)
There is no backend service in this repo. Architecturally it’s a single deployable client with clean internal layering: UI → State (Riverpod) → Repository → Local DB (Hive) + platform services (notifications).
• The app’s internal layers and data flow
• The platform boundary (Flutter/Dart vs native host)
• External dependencies (Hive storage engine, local notifications plugin, OS notification scheduler)
• Cross-platform build targets (Android/iOS/Web/Windows/macOS/Linux) as deployment nodes
From the tree + README, the meaningful architecture lives under lib/:
• lib/main.dart
App entrypoint: app bootstrap, provider scope, routing to screens, initialization (likely Hive + notifications setup).
• lib/models/task.dart, lib/models/task.g.dart
• lib/repositories/task_repository.dart
• lib/providers/*
Riverpod providers for tasks, theme, timer. This is the State Management / Application Layer.
• task_providers.dart (task list state, CRUD orchestration)
• timer_provider.dart (Pomodoro state machine/ticks)
• theme_provider.dart (theme mode state)
• lib/services/notifications.dart
• lib/screens/* + lib/widgets/*
Presentation layer: pages and reusable widgets.
• Screens: home_screen.dart, add_task_screen.dart, stats_screen.dart
• Widgets: pomodoro_timer.dart, task_card.dart
State / Application Layer (Riverpod)
• Task Providers (list, filters, CRUD triggers)
• Timer Provider (Pomodoro state, ticking)
• Theme Provider
Domain Layer
• Task model (+ Hive adapter codegen)
Platform/Integration Services
• Notifications service (wraps flutter_local_notifications)
• (Implicit) device clock/timers used by Pomodoro provider
Hive
• On mobile/desktop: file-based storage
• On web: browser storage backend (Hive’s web support)
Notification System (OS)
• Android NotificationManager, iOS UNUserNotificationCenter, etc.
• Web notifications may differ; if unsupported, note “platform dependent”.
Android / iOS / Web / Desktop shells
• Them as “hosts” containing the same Flutter app bundle.
Task CRUD flow
UI (Screens/Widgets)
→ reads/watches Task Providers (Riverpod)
→ providers call TaskRepository
→ Hive persists to Local Storage (File system / Browser storage)
→ provider updates state
→ UI re-renders
Pomodoro timer flow
PomodoroTimer widget / Home screen
→ watches Timer Provider
→ timer provider uses Dart timers/clock (or similar scheduling)
→ on timer completion triggers:
• UI updates
• optionally calls Notifications service to schedule/show a local notification
Notifications flow
UI/Providers
→ notifications.dart service
→ flutter_local_notifications plugin
→ Native OS notification APIs
→ user sees notification; tapping it may reopen the app (platform-dependent routing; annotate if not implemented explicitly)
Theme flow
UI
→ watches Theme Provider
→ MaterialApp themeMode changes
→ UI re-renders
From structure, it closely matches:
• Layered architecture / Clean-ish separation
• Presentation (screens/widgets)
• Application state (providers)
• Data access (repository)
• Persistence (Hive)
• Unidirectional data flow
• UI observes provider state; user events invoke provider/repository writes; state changes propagate back to UI.
• Adapter pattern for platform services
• Notifications service wrapping plugin APIs
• Code generation boundary
• task.g.dart (Hive adapter) generated via build_runner
Call these out as small annotations so readers understand why boundaries exist.
Riverpod Providers
• TaskProviders
• TimerProvider
• ThemeProvider
Domain + Data
• Task model (+ task.g.dart adapter)
• TaskRepository
Persistence & Platform
• Local Storage backend (File/Browser)
• Notifications Service → flutter_local_notifications → OS Notification System
A small side panel: Build/Targets
• Android shell (android/…)
• iOS shell (ios/…)
• Web (web/…)
• Desktop (windows/, macos/, linux/)
This makes it obvious it’s the same app deployed to multiple hosts.