How mohamedhamdysoftwareengineer/novaed works
Project Type & Purpose
• A multi‐platform Flutter front-end (Android, iOS, Web, Windows, macOS, Linux) implementing an interactive quiz & learning management system.
• Follows MVVM (Model-View-ViewModel) with Cubit (BLoC) for state management.
• Integrates with an external .NET backend (RESTful API) for data persistence and business logic.
High-Level File Structure Analysis
• Top-level directories for each target platform (android/, ios/, web/, windows/, macos/, linux/)—all running the same Flutter code.
• lib/ contains the app code:
• core/: shared services (api_service.dart, auth_http_client.dart), utilities (routing, constants, responsive helpers) and common widgets.
• features/: each feature (“LogIn”, “User Profile”, “Choice Screen”, “Quiz Screen”, “Home”, “Splash”) split into:
– data/models: JSON models for API payloads
– presentation/manager: Cubits (ViewModels) + states
– presentation/views: Flutter UI (Views + Widgets)
• main.dart: application entry, sets up routing, theming, and initial Cubit providers.
• pubspec.yaml: dependencies (flutter, bloc, http, etc.) and asset declarations.
Key Components
a. Presentation Layer (Views)
– Widgets under lib/features/.../views & views/widgets
– SplashView, LoginView, HomeView, ChoiceScreen, QuizScreen, UserProfileView
– Core widgets: BaseScaffold, CustomAppBar, BottomBar, ErrorScreen
b. ViewModel Layer (Cubits)
– auth_cubit (LogIn), profile_cubit (User Profile), submission_cubit (Choice), question_cubit (Quiz)
– Manage UI state and user interactions
c. Model Layer
– Data classes (user_model.dart, quiz_models.dart) mapping JSON ↔ Dart objects
d. Services Layer
– ApiService: general HTTP client wrapper
– AuthHttpClient: authenticated HTTP calls
– AuthService: login/logout token management
– (Future) other domain services: QuizService, ProfileService
e. External Backend & Persistence
– .NET REST API Server (Authentication, Quiz, Profile, Choice endpoints)
– Database (e.g., SQL Server) behind the .NET layer
f. Infrastructure & Assets
– Flutter Engine & Platform Channels (managed by generated files in android/, ios/, etc.)
– Local assets: fonts (assets/fonts), images (assets/images)
Relationships & Data Flow
• User taps a View → triggers Cubit event → Cubit calls appropriate Service → Service issues HTTP request → .NET API → Database → response JSON → mapped to Model → Cubit emits new state → View updates UI.
• Navigation: handled by AppRouter (core/utils/app_router.dart), pushes/pops Views based on Cubit states or user actions.
Architectural Patterns & Principles
• MVVM:
• View only renders UI and listens to Cubit state
• ViewModel (Cubit) contains business logic and orchestrates Services
• Model handles data structures and JSON serialization
• Separation of Concerns: UI, state management, network access, and data models are decoupled.
• Reactive Programming: Cubit streams drive UI updates.
• Scalability & Testability: each layer can be unit tested independently (see test/widget_test.dart).
• Clear component labels (e.g., “QuizScreenView”, “QuestionCubit”, “QuizService”, “QuizModel”).