This is a sample Flutter application demonstrating how to use the genkit_firebase_ai plugin.
- Flutter SDK
- Firebase CLI
- A Firebase project with "Blaze" plan (for Vertex AI) or appropriate setup for Gemini.
-
Install Dependencies
flutter pub get
-
Configure Firebase This project requires
firebase_options.dartwhich is git-ignored. Generate it usingflutterfire:flutterfire configure
Select your project and platforms (iOS, Android, macOS, Web).
-
Register an App Check debug token Firebase AI Logic enforces App Check, and the app uses the App Check debug providers. Run the app once, copy the debug token it logs (the browser console on web), and add it in the Firebase console under App Check > Apps > Manage debug tokens.
-
Run the App with Observability (Telemetry) To see Genkit traces and telemetry during development:
First, start the Genkit Developer UI:
genkit start
Look for the output line:
Telemetry API running on http://localhost:4033. (Usually it's port 4033, but it can be different).Then, in another terminal, run your Flutter app and pass the telemetry server address:
flutter run --dart-define=GENKIT_ENV=dev --dart-define=GENKIT_TELEMETRY_SERVER=http://localhost:4033
(Adjust the port if Genkit assigned a different one)
Open http://localhost:4000 in your browser to see the Genkit Developer UI.
Standard Flutter run (No Telemetry)
flutter run
- Chat with Gemini using Firebase AI.
- Tool calling demonstration (e.g.,
getWeather).