How ahmadmadani265/furniture_app works
Project Type and Purpose
• This is a multi-platform Flutter client app (“furniture_app”) targeting Android, iOS, Web, Linux, macOS, and Windows.
• The app’s main function is e-commerce for furniture: browsing categories, viewing product details, managing cart/favorites, and user authentication via Firebase.
File Structure
• Top-level platform folders: android/, ios/, web/, linux/, macos/, windows/ – embedding code for each target.
• lib/ holds all Dart code:
– lib/views & lib/widgets: UI layer
– lib/logic: Bloc/Cubit and Riverpod providers for state management
– lib/services: Firebase integration (auth, Firestore)
– lib/utils: routing, styling, theme, constants
– lib/main.dart: application entry point
• Configuration files: firebase_options.dart, android/app/google-services.json, ios/Runner/Info.plist for Firebase, pubspec.yaml for dependencies.
README Insights
• Standard Flutter “starter” project scaffold.
• Firebase is configured (firebase_options.dart) but no custom backend beyond Google’s Firebase services.
Main Components & Layers
• MainApp (lib/main.dart)
• AppRouter (lib/utils/app_router.dart)
• View Widgets (lib/views/ and lib/widgets/)
• Platform Embedders: Android Runner, iOS Runner, Web index.html, Desktop Runners
• Cubits (auth_cubit.dart) & States (auth_state.dart)
• Riverpod Providers (count_total_provider, my_cart_provider, etc.)
• FirebaseAuthService (lib/services/firebase_auth.dart)
• Firestore Repositories (if present or future expansion)
• Local caches/providers (optional)
• Firebase Auth (Cloud Auth)
• Firebase Firestore (Cloud Firestore)
• Firebase Storage (if used for product images)
• Other external APIs (none currently, but placeholder)
Relationships & Data Flow
1. App start → main.dart → runApp → initialize Firebase (firebase_options.dart)
2. AppRouter directs to SignIn/SignUp or Home based on auth state (AuthCubit)
3. UI Widgets dispatch user actions to Cubits/Providers
4. Cubit/Provider calls FirebaseAuthService or Firestore API
5. Firebase returns async responses → update Cubit state → UI rebuilds
6. Cart/Favorites flows similarly via providers and may persist in Firestore or local storage
Architectural Patterns & Principles
• Layered/Clean Architecture: clear separation between UI, state management, and data
• Bloc/Cubit Pattern for authentication flows
• Riverpod/Provider for lightweight state and dependency injection
• “Repository” abstraction in services layer for easy unit testing and future backend swap
• Platform-agnostic code in lib/; platform folders only for embedding