How alokjha2/fluttergame works
Project Type and Purpose
• This is a cross-platform mobile/desktop/web Flutter application (“Memory Game”), extended to include multiple mini-games (quiz, scavenger hunt, snap hunt, binod game) and multiplayer features.
• It ships to Android, iOS, Linux, Windows, macOS and web via the Flutter engine.
• It uses Firebase for authentication, real-time room services, and push notifications, plus a custom Node.js server for certain multiplayer or blog-fetching APIs, and a few Python scripts for offline data scraping.
File-Structure Analysis
• Top-level platform folders: android/, ios/, linux/, macos/, windows/, web/ – these contain the platform hosts and native scaffolding.
• lib/ directory:
• presentation/ (screens, router, widgets) – the UI layer
• controller/ & providers/ – state-management layer (GetX or Provider patterns)
• firebase/ – services for auth and real-time updates
• repository/ – interfaces for data and error handling
• api.py / server.js – external API clients and server
• model/ – data classes
• utils/ – constants and helpers
• server/ folder: Node.js backend (server.js) for real-time rooms.
• assets/: static assets (json, images, animations, sounds) used by the UI.
• Python scripts in lib/ for offline data scraping – not part of runtime but supporting asset generation.
Key Architecture Characteristics
• Layered pattern: Presentation → State management/controllers → Domain (services & repositories) → Data sources (Firebase, Node server, local JSON, assets).
• Cross-platform host with a single Dart codebase compiled by Flutter engine to multiple targets.
• Real-time multiplayer via WebSocket/HTTP in server.js & room_service.dart.
• Firebase Auth and cloud messaging integration.
Main Components & Interactions (
A. Presentation Layer (Flutter UI)
• Screens (homepage, game screens, quiz, profile, rooms)
• Widgets (cards, progress bars, buttons)
B. State & Navigation Layer
• Controllers (cardController, countDownController, gameTimerController)
• Providers (auth_provider, quiz_provider, binod_provider, etc.)
• Router (app_router.dart → routes.dart)
C. Domain/Service Layer
• Firebase Services (auth_checker.dart, room_service.dart, notify_handler.dart)
• Repositories (article_repository.dart, app_exception.dart)
• API Clients (lib/api.py calls, lib/fetchblog.py)
D. Data Sources
• Firebase Realtime/Firestore/Messaging
• Custom Node.js Server (server/server.js)
• Local JSON in assets/json/data.json
• Local assets (images, sounds, animations)
E. Platform Hosts
• Android, iOS, Linux, Windows, macOS, Web – Flutter engine bridges Dart code to native.
Final Checklist
• Annotations for cross-platform Flutter engine and host environments.
• A boundary showing locally-packaged assets vs. cloud/external services.