Inspiration
Weighing food and searching through endless databases is tedious. I wanted to build a "frictionless" tracker that uses the power of Multimodal AI to do the heavy lifting. The goal was to create an app where I could simply "snap" my meal—whether it's a complex Indian Thali or a quick snack—and have the nutrition logged instantly.
What it does
AI Food Analysis: Users take a photo of their meal, and Google Gemini 1.5 Flash identifies the food items, counts quantities (e.g., "2 Rotis", "1 Bowl Dal"), and estimates calories and macros (Protein, Carbs, Fats).
Hybrid Input: Users can add text hints (e.g., "Oat milk latte") to guide the AI for higher accuracy.
Barcode Scanning: Integrated scanner using OpenFoodFacts API for instant logging of packaged goods.
Smart Dashboard: Visualizes daily progress with dynamic Pie Charts and linear progress bars against user-set goals.
Local History: "Quick Add" feature that remembers past meals for one-tap logging without needing to re-scan.
Water Tracker: A simple, integrated hydration counter.
How we built it
Framework: Built with Flutter (Dart) for a smooth, native cross-platform experience.
AI Engine: Integrated Google Generative AI SDK to communicate with the Gemini 1.5 Flash model. We used advanced prompt engineering to force the AI to return structured JSON data with "per unit" calorie estimates.
Database: Used SQFLite for a local-first architecture. All user logs, history, and settings are stored securely on the device, ensuring the app works offline (for history) and respects privacy.
Visuals: Implemented fl_chart for data visualization and custom dark-mode UI components.
Hardware Integration: Used mobile_scanner for CameraX implementation and shared_preferences for persisting user goals.
Challenges we ran into
The "Release" Build Trap: The app worked perfectly in debug mode but failed in the release APK. We learned the hard way that Android requires explicit INTERNET permissions in the Manifest for release builds.
Android 14 Compatibility: Integrating Health Connect required upgrading our build system to API 34, which caused a cascade of Gradle and Kotlin version conflicts that we had to resolve manually.
AI Hallucinations: Initially, the AI would struggle to differentiate similar-looking liquids (like Tea vs. Coffee). We solved this by implementing a Hybrid Input System, sending both text and image context to the model for near-100% accuracy.
Camera Permissions: We faced the dreaded "Black Screen" issue when implementing the barcode scanner, which taught us the difference between Manifest Declarations and Runtime Permissions.
Accomplishments that we're proud of
Custom Prompt Engineering: We successfully taught Gemini to "count" items (e.g., recognizing 3 separate cookies instead of just "cookies") and return data in a strict JSON format that our Dart code could parse automatically.
Zero-Server Cost: By using Gemini's API directly from the client and storing data locally with SQLite, the app is completely serverless and free to maintain.
Full CRUD Functionality: Unlike simple demos, CalMan allows users to Edit, Delete, and Update their logs, making it a fully functional daily driver.
What we learned
Flutter Lifecycle: Deepened our understanding of StatefulWidgets, setState, and asynchronous UI updates (FutureBuilder).
Android Ecosystem: Learned the intricacies of minSdkVersion, targetSdkVersion, and how strictly Android 14 handles permissions for Health Connect and Cameras.
Mobile AI: Gained practical experience in integrating Large Language Models (LLMs) into mobile apps, specifically handling latency and unstructured data responses.
What's next for CalMan
Weekly Analytics: Adding bar charts to visualize calorie trends over the last 7 or 30 days.
AI Nutrition Coach: Implementing a chat interface where users can ask Gemini for diet advice based on their actual logged history.
Health Connect Sync: Finalizing the two-way sync to write nutrition data directly to Google Fit and Samsung Health.
Export to PDF: Generating monthly nutrition reports for users to share with doctors or trainers.
Log in or sign up for Devpost to join the conversation.