How xxpakogamer10xx/laboratoriodigital works
Project type and purpose
• This is a cross‑platform Flutter application (mobile, web, desktop) called “Laboratorio Digital.”
• It provides interactive educational tools powered by Google’s Generative AI (Gemini) and Firebase (Authentication & Firestore).
• The core use cases: user login/registration, conversation‑style AI assistants (mathematics, physics, IEEE norms), graph/visualization tools (area under a curve, motion graphs), PDF/image analysis, and persistent chat history.
File structure
• Top‑level “android/”, “ios/”, “linux/”, “macos/”, “windows/” folders: platform‑specific native hosting code and build scripts.
• “lib/”: all Dart source for UI and business logic—main.dart, pages for each feature (MathExpertPage.dart, AreaVisualizerPage.dart, etc.), auth_gate.dart, firebase_options.dart.
• “assets/” & “fonts/”: static resources (Logo.jpg, custom fonts).
• “web/”: Web‑specific entry (index.html, manifest.json).
• “test/”: widget/unit tests.
• Configuration/build files: pubspec.yaml, .env (Gemini API key), firebase.json, platform build scripts (CMakeLists.txt, Gradle .kts).
Key insights from README
• Architecture is client‑heavy: Flutter UI + state management → calls Firebase SDKs and Gemini API.
• Persistent history stored in Firestore.
• Visualization uses CustomPaint & fl_chart.
• LaTeX rendering via flutter_math_fork and math_expressions.
a. Main components
• Flutter Client
– UI Layer (Widgets, Pages)
– Business Logic / State Management (could be Provider, setState, etc.)
– Data Services (FirebaseAuth, FirestoreService, GeminiService, FileService)
• Platform Runners (Android, iOS, Web, Desktop hosts)
• External Services
– Firebase Authentication
– Firebase Firestore (chat histories, user profiles)
– Google Generative AI (Gemini API)
– (Optionally) Cloud Storage for file uploads if used
b. Relationships & data flow
– User interacts with Flutter UI → triggers Business Logic → calls Data Services.
– Authentication flows: Flutter → Firebase Auth → returns user token → gating UI.
– Chat/assistant flows: Flutter → GeminiService (HTTP REST/gRPC) → AI responses → store & retrieve history in Firestore → render in UI.
– Visualization tools: Flutter UI → CustomPaint/fl_chart → compute/render graphs locally.
– PDF/Image analysis: Flutter → FileService → pass binary to Gemini or custom parser → return analysis.
c. Architectural patterns & design principles
– Layered pattern: Presentation → Domain (business logic) → Data (services/SDK wrappers).
– Separation of concerns: each assistant page corresponds to its own service class (e.g., MathExpertService).
– External API integration via environment‑driven configuration (flutter_dotenv).
– Plugin-based platform integration for file picking, permissions, device info.
d. Key technologies & frameworks
– Flutter (Dart) for UI & logic
– Firebase SDKs (Auth, Firestore)
– Google Generative AI API (google_generative_ai package)
– Visualization: CustomPaint, fl_chart
– Math parsing/rendering: math_expressions, flutter_math_fork
– File & permissions: file_picker, permission_handler, device_info_plus
– Environment management: flutter_dotenv
– Markdown rendering: flutter_markdown