How bizz84/complete-flutter-course works
Project Type & Purpose
• This is a full-stack, cross-platform Flutter eCommerce application (mobile: Android/iOS, desktop: macOS/Windows, web) built using the Controller-Service-Repository pattern with Riverpod. The “backend” in this course is represented by fake repositories and local persistence (Sembast) to simulate remote services (e.g., Firebase Auth, Firestore), but the architecture is fully layered and ready to plug in real cloud services.
File Structure Analysis
• Top‐level shells: android/, ios/, macos/, windows/, web/ each contain the native project that loads the Flutter engine.
• Core Flutter code: under lib/ subdivided into:
• src/presentation: Widgets and screens (UI layer).
• src/routing: GoRouter setup.
• src/utils, src/common_widgets: UI helpers and utils.
• src/features: By feature (authentication, products, cart, checkout, orders, reviews). Each feature follows Feature → Domain → Data → Presentation → Application (controllers/services).
• Test suites mirror the feature structure under test/.
• Config/build: pubspec.yaml, Gradle, Cocoapods, CMake, GitHub workflows.
Insights from README
• Uses Riverpod for state management.
• Applies Controller-Service-Repository pattern.
• Swappable “fake” repositories for local/in-memory persistence.
• Placeholder for Firebase & real back‐end connectivity.
• GoRouter manages navigation.
Diagramming the Architecture
a. Main Components
• Platform Shells: Android, iOS, macOS, Windows, Web
• Flutter Engine & Framework
• App Core:
• Presentation Layer (Widgets, Screens)
• State Controllers (Riverpod StateNotifiers/Providers)
• Services Layer (CartService, ReviewsService, etc.)
• Repository Layer (FakeAuthRepository, RemoteCartRepository, SembastCartRepository)
• Domain Layer (Entities: Product, Order, Cart, User)
• Data Sources:
• Local DB (Sembast)
• InMemoryStore (RxDart)
• Remote API (simulated/fake)
• External Services (for real prod): Firebase Auth, Firestore, Payment Gateway
b. Relationships & Interactions
• UI widgets send user actions to Controllers via Riverpod providers.
• Controllers invoke corresponding Services.
• Services call Repositories through abstract interfaces.
• Repositories delegate to Data Sources (local vs remote) based on environment or user offline/online status.
• Local Data Source persists to Sembast; Remote Data Source calls cloud APIs.
• Services may synchronize local and remote (e.g., CartSyncService listens to changes and pushes updates).
• Domain entities flow up from data sources → repositories → services → controllers → widgets.
c. Architectural Patterns & Principles
• Layered architecture (Presentation → Application → Domain → Data → Infrastructure).
• Feature-first project organization.
• Controller-Service-Repository pattern.
• Dependency injection via Riverpod.
• Separation of concerns: navigation (GoRouter), UI, state, business logic, persistence.
d. Key Technologies & Frameworks
• Flutter (Dart)
• Riverpod (state management + code generation)
• GoRouter (routing)
• Sembast (local persistence)
• RxDart (in-memory reactive store)
• GitHub Actions (CI tests)
Essential Details to Capture
• Clearly distinguish Fake vs Local vs Remote repositories.
• How CartSyncService hooks into the app startup (e.g., via a ProviderObserver or top-level ProviderContainer).
• GoRouter entry in app_router.dart.