Genkit Dart with Firebase: Full-Stack AI Features for Flutter Apps
Genkit Dart went from preview to 1.0 in 2026. Here's how to pair it with Firebase for type-safe AI backends behind your Flutter app.
Published on • October 19, 2026
AI Assistant

Genkit — Google’s open-source AI framework — gained a Dart SDK in March 2026 with the preview launch of Genkit Dart, and hit its first stable release on October 8, 2026 with Genkit Dart 1.0. For Flutter teams already living in Firebase, that combination closes a gap that used to force a choice: write your AI backend in TypeScript and lose language sharing with your app, or glue together ad-hoc Gemini calls in the client with no observability.
With Genkit Dart, your flows and your Flutter app are the same language, sharing the same schemas — and Firebase is where you host and secure them. Here’s how the pieces fit.
What Genkit Dart gives you
From the preview announcement:
- Model-agnostic API. Google, Anthropic, OpenAI, and OpenAI-compatible models behind one interface, registered as plugins:
final ai = Genkit(plugins: [googleAI(), anthropic()]);
final fromGemini = await ai.generate(
model: googleAI.gemini('gemini-flash-latest'),
prompt: 'Draft a summary of this invoice.',
);
- Type-safe flows. You wrap AI logic in
defineFlowwith input/output schemas from theschemanticpackage — testable, observable functions you can deploy as HTTP endpoints. - Runs anywhere Dart runs. The same flow code runs in your Flutter app for prototyping, on a Dart server in production, or behind a lightweight proxy that holds your API keys.
- A local Developer UI.
genkit start -- dart run bin/server.dartlaunches a localhost UI for testing prompts, stepping through traces, and debugging multi-step runs. - The complete toolkit. Structured output, tool calling, multi-turn conversations, streaming, and built-in observability.
By 1.0, that also includes human-in-the-loop interrupts, generation middleware, Dotprompt prompt templates, and genkit_otel for exporting traces and token metrics via OpenTelemetry’s GenAI semantic conventions.
The architecture: Firebase in front, Genkit behind
The pattern that makes sense for a production Flutter app has three layers:
- Firebase Auth authenticates your users in the Flutter client.
- A Dart server runs your Genkit flows, keeping prompts and API keys out of the app binary.
- Your Flutter app calls those flows with type-shared schemas — carrying the user’s Firebase ID token so the server can enforce authorization.
A flow on the server:
import 'package:genkit/genkit.dart';
import 'package:genkit_google_genai/genkit_google_genai.dart';
import 'package:schemantic/schemantic.dart';
part 'trip_flow.g.dart';
@Schema()
abstract class $TripRequest {
String get destination;
int get days;
}
void main() async {
final ai = Genkit(plugins: [googleAI()]);
final planTrip = ai.defineFlow(
name: 'planTrip',
inputSchema: TripRequest.$schema,
outputSchema: .string(),
fn: (request, _) async {
final response = await ai.generate(
model: googleAI.gemini('gemini-flash-latest'),
prompt: 'Plan a ${request.days}-day trip to ${request.destination}.',
);
return response.text;
},
);
await (GenkitRouter()..addAction(planTrip)).serve(port: 8080);
}
And the matching call from Flutter, with a Firebase ID token attached:
import 'package:genkit/client.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:my_shared_models/models.dart'; // same schemas as the server
final planTrip = defineRemoteAction(
url: 'https://your-server.com/api/planTrip',
inputSchema: TripRequest.$schema,
outputSchema: .string(),
);
final token = await FirebaseAuth.instance.currentUser!.getIdToken();
final itinerary = await planTrip(
input: TripRequest(destination: 'Kyoto', days: 5),
headers: {'Authorization': 'Bearer $token'},
);
Because the schema classes live in a shared package, a change to TripRequest breaks the build on both sides instead of failing at runtime — end-to-end type safety across the client/server boundary, which is the headline feature of the 1.0 release.
Where Firebase Hosting and Functions fit
Be precise about the current state, because it’s asymmetric:
- The documented
onCallGenkitintegration — wrapping a flow as a callable Cloud Function with an auth policy and secrets — is a TypeScript/JavaScript path today (Genkit’s Firebase deployment guide). If your team already has a JS functions codebase, that route is unchanged. - Dart Genkit flows deploy as ordinary Dart servers: anything that can run Dart can host them, which is the standard Cloud Run or any-VM story, exposed via
GenkitRouteror thegenkit_shelfpackage. - The roadmap points at the gap closing. The 2026 Flutter and Dart roadmap lists “Dart Cloud Functions for Firebase” as a major focus — targeting roughly 10ms cold starts — alongside active work with the Genkit team on Dart support. First-party Dart functions plus Genkit flows is the direction of travel.
Until then, the recommended production shape is: Dart/Genkit backend on Cloud Run (or your own infrastructure) + Firebase Auth for identity + Cloud Run IAM or your own middleware for authorization. The same ID-token header pattern above works.
Firebase-side AI features, no server required
For the parts of your app that just need direct model access — summarizing user content, generating titles — Firebase AI Logic calls Gemini from the Flutter client with your Firebase project mediating access, and 3.44 added Server Prompt Templates so prompts can live server-side. The division of labor is simple: Firebase AI Logic for straightforward client-side calls, Genkit Dart for flows with tools, branching, and state.
Sessions, agents, and Firestore
If you go further into agentic territory, Genkit Dart 1.0’s experimental APIs lean on Firebase directly: the defineAgent example in the announcement uses FirestoreSessionStore(collection: 'sessions') to persist conversation state across turns and app restarts — imported from package:genkit/experimental.dart. Agent memory in Firestore, model calls through Genkit, identity through Firebase Auth: one vendor’s stack, one consistent story.
Getting started
dart pub add genkit genkit_google_genai schemantic
# Run your server with the Developer UI attached
genkit start -- dart run bin/server.dart
# Optional: give your AI coding assistant up-to-date Genkit knowledge
npx skills add genkit-ai/skills
Then follow the Genkit Dart quickstart, keep your API keys on the server, put an auth policy in front of every deployed flow, and wire your Flutter client to those flows with defineRemoteAction. Genkit Dart 1.0 is on pub.dev today.