How shaunaksawargaonkar/papa_pro_vision works
Project Type and Purpose
• This is a multi-platform Flutter application (Android, iOS, Web, Linux, macOS, Windows) that:
• Captures images via camera
• Sends images and user voice prompts to a Gemini 2.5 flash LLM service
• Receives and displays LLM responses
• Reads responses aloud (multi-engine TTS)
• Supports voice input in Marathi and other languages
• Provides in-app payments, analytics, local storage, and file sharing
Main Components
A. Presentation Layer (UI)
• lib/UI – pages (Registration, PhoneAuth, HomeScreen, ProfilePage), widgets (mic button, image preview, sidebar)
• Flutter’s Navigator & Material widgets
B. State Management
• lib/StateManagement/button_state_provider.dart (Provider pattern)
• Service locator (lib/Txt2Speech/service_locator.dart)
C. Core Services & Helpers
• & Device Access
– DeviceHelper.dart (camera, microphone)
– DeviceAudioHelper.dart (playback)
• Local Data
– DatabaseHelper.dart (SQLite or shared prefs)
– FileSharingHelper.dart
• Analytics
– AnalyticsHelper.dart
• Payment
– payment_gateway.dart, payment_utils.dart (Razorpay integration)
D. LLM Interaction
• lib/LLMResponse/agent_service.dart (HTTP client to Gemini API)
• system_prompt_enums.dart (prompt templates)
E. Text-to-Speech Engines
• flutter_tts.dart (flutter_tts plugin)
• google_tts.dart (Google TTS REST client)
F. Platform Runners / Native Code
• Android (Kotlin MainActivity + Gradle)
• iOS/macOS (Swift AppDelegate)
• Linux/Windows runner (C++ entry points, CMake)
• Web (index.html, manifest)
Relationships & Data Flows
1. User taps “Capture” in UI → DeviceHelper opens camera → returns image
2. UI passes image + optional voice prompt to LLM service via agent_service
3. LLM HTTP call → Gemini 2.5 API → returns JSON analysis
4. agent_service parses JSON → returns structured text
5. UI displays text (HomeScreen / ProfilePage)
6. Text → Service Locator picks TTS engine → flutter_tts or google_tts
7. TTS audio stream → DeviceAudioHelper → plays through speaker
8. Payment flows are handled similarly: UI → payment_gateway → external Razorpay SDK → callback → state update
9. AnalyticsHelper logs key events
Architectural Patterns & Principles
• Layered architecture: UI → State/Controllers → Services → External
• Dependency Injection via service_locator
• Provider for state notifications
• Separation of concerns: Helpers isolate platform APIs
• Cross-platform via Flutter engine + native runners