A Flutter app that identifies plants from photos on your device. You pick an image from the camera or gallery, send it to Google Gemini (vision), and get a common name, scientific name, short description, and care hints for water, sunlight, and soil.
- On-device capture — Camera or photo library via
image_picker. - AI identification — Multimodal prompt with
google_generative_ai(gemini-2.5-flash). - Structured results — Parsed JSON with plant metadata and a simple care guide UI (Material 3).
- Non-plant handling — The model can respond with
is_plant: falsewhen the image is not a plant.
- Flutter (Dart SDK ^3.7.2 as in
pubspec.yaml) - A Google AI Studio API key for the Gemini API
git clone <your-repo-url>
cd plant_identifier
flutter pub getThe app reads the key from compile-time defines (AppConfig uses String.fromEnvironment('GEMINI_API_KEY', ...)).
Recommended: pass the key when you run or build — it stays out of source control:
flutter run --dart-define=GEMINI_API_KEY=YOUR_KEY_HERERelease builds:
flutter build apk --dart-define=GEMINI_API_KEY=YOUR_KEY_HERE
flutter build ios --dart-define=GEMINI_API_KEY=YOUR_KEY_HEREIf GEMINI_API_KEY is empty at runtime, identification will fail with a clear error.
Security: Do not commit real API keys. Prefer
--dart-define, CI secrets, or a local untracked config — never push keys to a public repository.
| Path | Role |
|---|---|
lib/main.dart |
App entry, wires repository + home page |
lib/core/config/app_config.dart |
GEMINI_API_KEY from environment |
lib/domain/ |
Entities, repository contract, failures |
lib/data/ |
Gemini remote data source, repository implementation |
lib/presentation/ |
Page, controller, widgets |
This follows a small clean architecture split so you can swap the AI backend or add local caching without rewriting the UI.
Android (AndroidManifest.xml): camera and media read permissions are declared for capture and gallery.
iOS (Info.plist): NSCameraUsageDescription and NSPhotoLibraryUsageDescription are set for App Store compliance.
Identifications are best-effort from a generative model. They may be wrong or incomplete. Use for curiosity and gardening hints, not as the sole basis for toxicity, foraging, or medical decisions.