How sonialr7iny/iquotes works
Project Type & Purpose
• Type: Cross-platform mobile/desktop/web app built with Flutter & Dart.
• Purpose: A standalone quotes manager with secure user authentication, local SQLite storage, Bloc/Cubit state management, dark mode, and no external backend.
High-Level Architectural Layers
a. Presentation Layer (UI)
– Flutter Widgets & Screens (in lib/modules & lib/layout)
– Theme & Styles (lib/shared/styles)
b. State Management Layer
– Cubits/Blocs (lib/shared/cubit & sign_in_with_cubit.dart, register_with_cubit.dart, etc.)
c. Data Layer
– Repository/Data Sources:
• SQLite local database (quotes_sqflite.dart + sqflite plugin)
• SharedPreferences (cache_helper.dart + shared_preferences plugin)
– Models (lib/models/quote_model.dart)
d. Service/Utility Layer
– BCrypt hashing service for passwords
– Input validation (regex in forms)
e. Plugins & Platform Integration
– Flutter plugins: sqflite, shared_preferences, bcrypt
– Platform channels handled by each plugin under android/, ios/, web/, windows/, linux/, macos/
f. Platform Hosts
– Android (Gradle/Kotlin entrypoint MainActivity.kt)
– iOS (AppDelegate.swift + Xcode project)
– Web (index.html + flutter_bootstrap.js)
– Desktop (Windows, Linux, macOS runner code)
Main Components & Their Relationships
• Presentation → interacts with → State Management
• State Management → dispatches calls to → Data Layer (Repositories)
• Data Layer → uses → Local DB (SQLite) and Local Cache (SharedPreferences)
• Service Layer (BCrypt, Validators) → called by → State Management (during auth flows)
• Plugins → mediate between Data Layer & Native Platform
• Platform Hosts → load → Flutter Engine → run → Dart code
Important Architectural Patterns & Principles
• Layered Architecture: presentation, business logic, data, platform
• Bloc/Cubit: unidirectional data flow—UI dispatches events, Cubit updates state, UI rebuilds.
• Repository Pattern: abstracts away raw DB calls behind quotes_sqflite.dart and cache_helper.dart
• Dependency Injection (implicit via static helpers or passing instances into Cubits)
• Cross-platform code reuse: one lib/ folder driving multiple native targets
Detailed Element List
• UI Modules: welcome_screen, splash_screen, quotes_screen, archived_screen, favorites_screen, etc.
• Cubits: AuthCubit (register/login), QuotesCubit (insert/update/delete/fetch), ThemeCubit (dark/light mode)
• Data Sources: CacheHelper (SharedPreferences), QuotesSqflite (SQLite)
• Models: QuoteModel
• Third-party plugins: flutter_bloc, sqflite, shared_preferences, bcrypt
• Native Hosts: Android’s MainActivity, iOS AppDelegate, Web index.html, Desktop runners