How ironmax123/flutterjr-hackathon works
Project Type and Purpose
• This is a Flutter mobile application (with Android, iOS, and web targets) primarily built around a social or communication theme. Its functionality includes a home screen with a timer and camera for auto-posting, an invitation screen for friend management (including QR code and SNS sharing), and sections for viewing friends’ posts and personal timelines.
• The README explicitly mentions using an MVVM pattern combined with a repository abstraction, with additional hints toward a separation of concerns, making it a full-stack (or rather fully layered mobile) application.
Major Components
a. User Interface / Presentation Layer:
• All the UI components are grouped under lib/feature and lib/primary. For example, the home view, invitation view, login, posts view, etc.
b. MVVM (ViewModel) Layer:
• For each feature, there is a “vm” file (e.g., home/vm.dart, invitation/vm.dart, posts/vm.dart) that handles the business logic/state management. This is a crucial component that links the UI with the data sources.
• Connection from each UI component to its corresponding ViewModel(s).
c. Repository / Data Layer:
• Under lib/repository and lib/data, the project defines data structures and repositories for entities (friend, post, sample, user) using code generation (notice “entity.freezed.dart” and “entity.g.dart”).
• This layer as the abstraction that interacts with the underlying data stores.
d. Service Layer:
• The service folder (lib/service) shows services corresponding to each domain (friends, post, sample, user) which likely implement business rules and network logic.
• This layer fetches or updates data by communicating with repositories or external APIs.
e. Backend / External Services:
• Although the backend is “hidden” from a code perspective, the README and file tree (lib/supabase) indicate usage of the Supabase backend service.
f. Additional Components:
• Routing: lib/routers/router.dart uses go_router, indicating central management of navigation between screens.
• Cross-cutting concerns like state management (via riverpod, flutter_hooks) and asynchronous functionalities (e.g., timers, audio playback using just_audio) should be highlighted.
• Utility functions are bundled under lib/primary/utils and lib/utils.
Relationships and Data Flow
• How the UI components communicate with the ViewModels (using state management libraries like Riverpod and flutter_hooks), which in turn interact with the repository layer.
• That the repository abstracts away data sources and might interact with local data (entities in lib/data) and the external backend via Supabase.
• Routing mechanism that connects various screens.
• Dependency on external packages (camera, QR code, audio) as auxiliary modules integrated into the UI or service layer.
Architectural Patterns and Design Principles
• MVVM pattern, showing the direction of data flow: UI (View) → ViewModel → Repository/Service → External Backend.
• That the repository pattern is used to decouple the data sources from business logic.
• Code generation practices (using Freezed, Riverpod Generator, etc.), which help keep the data and state model defined and immutable.
• Modularization of features based on the directory structure (each feature has its own components and view models).