"Genkit Dart: Your First Type-Safe AI Flow with Gemini"

"Stop passing Maps to your AI backend and praying the keys match. This genkit dart defineFlow example builds a typed flow with schemantic — real Dart classes on the server and the Flutter client — served over HTTP and tested in the Genkit Developer UI."

Here's the payoff up front: one @Schema definition gives you a Dart class on your Genkit server and on your Flutter client. Change a field, and the compiler — not your users — tells you every place that broke. That end-to-end type safety is why Genkit Dart exists: backend and app are both Dart, so they share one understanding of every request. This genkit dart defineFlow example builds one real flow end to end: scaffold, schemas, the flow, serving it, and calling it from Flutter. A flow is Genkit's unit of AI work: a named, typed function that takes a typed input, does AI things, and returns a typed output — with tracing, a Developer UI, and an HTTP endpoint included. The plan: one typed flow, end to end We'll build a "trip idea" API — send a destination and a budget, get back a typed itinerary suggestion. Along the way: Scaffold a Dart server with pinned, current package versions Define typed input/output schemas with schemantic and generate the code Write the flow with defineFlow , calling gemini-2.5-flash inside Serve it over HTTP with genkit_shelf Call it from Flutter with a typed client — no manual JSON parsing Test the whole thing in the Genkit Developer UI Scaffold the server and pin your versions Create a plain Dart console project for the backend — it stays separate from your Flutter app: dart create -t console-simple trip_api_server cd trip_api_server dart pub add 'genkit:^0.17.0' 'genkit_google_genai:^0.4.0' \ 'genkit_shelf:^0.2.0' 'schemantic:^0.2.3' 'dev:build_runner:^2.10.5' Pinning matters more than usual here: genkit 0.17 (September 2026) changed the client API, so tutorials pinned to 0.16.x show client code that no longer compiles. Pin to the current versions and upgrade deliberately. Get…

Explore