How anirban6311/stadium_app-state-management- works
Project Type and Purpose
• This is a cross-platform Flutter application (mobile, web, desktop) named “hero_animation” (per Android package).
• It helps users browse stadium information, manage wishlists, plan visits, take notes, view country posts, and see about-screen details—all orchestrated via rich animations.
• It uses feature-based modules with the BLoC pattern, local persistence (db_helper.dart), and external data (PostsRepo).
File Structure
• Top-level folders for each build target: android/, ios/, web/, windows/, macos/, linux/
• lib/: core Dart code
• data/: shared data models and helpers (db_helper.dart, app_overview_data.dart, stadiums_data.dart, planned_items.dart, wishlist_items.dart)
• features/: seven feature folders (about, country, home, notes, planned, splash_screen, stadium_view, wishlist), each containing:
– bloc/ (about_bloc.dart, posts_bloc.dart, etc.)
– ui/ (about_page.dart, posts_page.dart, etc.)
– models/ and repos/ where applicable (country/models, country/repos/posts_repo.dart)
• main.dart: single entry point
• assets/: JSON animations & images
• config/build files: pubspec.yaml, android/gradle.*, ios/Runner.xcodeproj, etc.
Architectural Patterns
• Feature-first modularization: each feature encapsulates its UI, BLoC, and models
• BLoC pattern for event→state state management (flutter_bloc)
• Repository pattern isolates data-access logic (PostsRepo, local DB via db_helper)
• Single entry point (main.dart) sets up navigation and dependency providers
Main Components
a. Presentation Layer (UI)
– Screens & Widgets (home_page.dart, stadium_view.dart, notes_page.dart, etc.)
– Asset Loader (loads JSON animations & images)
b. State-Management Layer
– BLoC per feature (HomeBloc, StadiumViewBloc, NotesBloc, PostsBloc, AboutBloc, PlannedBloc, WishlistBloc, SplashScreen has no BLoC)
c. Data / Repository Layer
– Repositories (PostsRepo for country data, db_helper for local SQLite)
– Data Sources:
• Local DB (db_helper.dart → SQLite)
• Remote API (PostsRepo → HTTP)
• Static Assets (stadiums_data.dart, JSON animations)
d. Platform Layer
– Flutter Engine + Platform Channels
– Build targets (android/, ios/, web/, windows/, macos/, linux/)
Relationships & Interactions
1. User interacts with UI → UI dispatches Event →
2. BLoC receives Event → Business Logic → calls Repository →
3. Repository chooses Data Source → fetches/mutates data (Local DB or Remote HTTP or Asset) →
4. Repository returns Model → BLoC emits new State →
5. UI subscribes to State stream and rebuilds
Essential Elements
• Clear labels on every component (e.g. “WishlistBloc”, “db_helper.sqlite”)
• Modular boundaries (feature outlines)
• Platform build targets grouped around the Flutter Engine