How openconsultinggroup/taxi-app works
Project type and purpose
• This is a full-stack (mobile) application built with Flutter. It targets Android and iOS, and implements state management using the BLoC pattern.
• Purpose: a taxi-booking UI prototype that shows map markers, animations, polylines, and simulates booking flow while managing state centrally.
File structure
• Top-level mobile platforms:
• android/ – Gradle scripts, AndroidManifest, Kotlin MainActivity, Firebase config
• ios/ – Xcode project, Swift AppDelegate, CocoaPods, iOS asset catalogs
• Core Flutter code under lib/:
• main.dart – entry point
• screens/ – UI pages
• widgets/ – reusable UI components
• bloc/ – BLoC classes (events, states, bloc)
• controllers/ – application logic (wrap BLoC or handle side effects)
• models/ – data structures (taxi, user, booking, etc.)
• storage/ – local persistence (e.g., taxi_booking_storage.dart)
• pubspec.yaml lists dependencies: google_maps_flutter, flutter_bloc, bloc, equatable, shimmer, location.
Key architecture insights from README
• Uses BLoC for state management (“central place” for data and events).
• Integrates with Google Maps API and location plugin.
• Encourages separation of concerns: UI only displays, BLoC handles events & state, controllers handle business logic.
Main components
a. Frontend/UI Layer
– Flutter Screens (home_screen.dart)
– Widgets (map view, booking flow, animations)
b. State Management Layer
– BLoCs (taxi_booking_bloc)
– Events & States
c. Controllers / Services Layer
– location_controller
– taxi_controller
– payment_method_controller
– taxi_booking_controller
– user_controller
– user_location_controller
d. Data Layer
– Models (Taxi, Booking, User, Location, PaymentMethod)
– Storage (taxi_booking_storage) – local persistence (SharedPreferences or file)
e. Platform / Integration Layer
– Google Maps SDK (google_maps_flutter)
– Location plugin (location)
– Firebase (analytics/auth if added later)
f. Mobile OS Hosts
– Android (MainActivity → FlutterEngine)
– iOS (AppDelegate → FlutterEngine)
g. External Services
– Google Maps APIs
– (Potential) Firebase Cloud services
Relationships & interactions
• User taps UI → UI widget dispatches BLoC event → BLoC processes via controllers → may read/write storage or call platform plugins → updates BLoC state → UI rebuilds.
• LocationController uses location plugin → provides current coords → BLoC feeds to UI map.
• TaxiController / BookingController simulates booking logic, updates Models, persists via Storage.
• Widgets subscribe to BLoC state streams to render map markers, polylines, animations.
Architectural patterns & design principles
• BLoC pattern: clear separation of UI (presentation) and business logic.
• MVC-like layering: UI → BLoC/controllers → data/storage → external services.
• Dependency injection (via context.read<Bloc>()) ensures testability.
• Single Responsibility: each controller handles its domain, each model is an immutable data carrier (Equatable).
Checklist before you finalize
• Every component from the file tree is represented or logically grouped.
• All data flows (UI ↔ BLoC ↔ Controller ↔ Storage/Plugin) are shown.
• External dependencies (google_maps_flutter, location) are distinct.