How hieutbui/ecoparking_flutter works
Project Type and Purpose
• This is a full-stack Flutter application designed for two main use cases: (a) users finding parking lots, and (b) parking owners/employees managing their parking. It leverages a mobile/web cross‐platform Flutter codebase with native implementations for Android, iOS, Linux, macOS, Windows, and web.
• The app uses Supabase as its primary backend (for database, auth, and functions) and integrates third-party services such as Stripe for payments, Mapbox for map functionalities, and Google for OAuth sign-in.
Key Architectural Layers & Components
a. Presentation (Frontend/UI Layer):
• Flutter “pages” (e.g., home, login, register, profile, ticket details) and “widgets” (action_button, search_bar, etc.) which define the user interface.
• That the UI is cross-platform, targeting mobile (Android/iOS) and desktop/web via separate folders (android, ios, web, etc.).
b. Application / State Management:
• “lib/app_state” and “lib/domain/state” directories that manage application status, login states, markers (parking information), and other feature-specific states.
• This layer bridges UI events with domain logic.
c. Domain Layer:
• Encompass “lib/domain” including repositories, services, usecases, and state management. This layer handles business logic such as login flows, parking service interactions, payment handling, etc.
• How user actions trigger usecases (like booking a ticket, searching parkings) that then leverage the repository interfaces.
d. Data Layer:
• “lib/data” which is divided into:
• Data Sources: Both remote (making API calls to Supabase, Stripe, Mapbox) and local (maybe through Hive or caching mechanisms). For instance, datasources for login, markers, payment, etc.
• Repositories (in “lib/data/repository” and “lib/domain/repository”): These implement the contract defined in the domain layer and call the relevant datasources.
• Network Layer: Highlight the presence of “lib/data/network/dio_client.dart” and payment APIs that handle HTTP requests.
• Integration with Supabase: Note the “lib/data/supabase_data” folder which includes bucket and table definitions indicative of how data storage is structured with Supabase.
e. Dependency Injection & Configuration:
• “lib/di” folder which shows the management of dependency injection (using GetIt, Hive initializers, and network/supabase utilities).
• Also, the configuration files in “lib/config” (app_config, app_routes, env_loader, and themes) should be represented.
f. External Services:
• Stripe: Show integration with Stripe for payment processing.
• Mapbox: Indicate integration for mapping services.
• OAuth Providers: Represent Google and Facebook sign-in through the specific mixins.
g. CI/CD & Project Management:
• (Optional) Include components for GitHub workflows, issue/PR templates, and release management as seen in the “.github” folder. Although not core to runtime architecture, they ensure quality and deployment automation.
Relationships & Interactions
• From UI components (pages/widgets) → to State Management → to Domain Usecases.
• Domain usecases interact with repositories in the Data Layer to fetch/store data.
• The Data Layer makes HTTP/network calls to external services (Supabase, Stripe, Mapbox).
• Dependency injection container (GetIt) as an orchestrator that wires these components.
Final Steps
• Provide detailed annotations if needed to explain interactions, especially where architectural patterns like MVC or Clean Architecture are being followed.