Published November 25, 2026
Build Full-Stack Agentic UI with Dart, Flutter, and Genkit
The Flutter team published a full walkthrough on November 24 that builds a dining concierge for a fictional restaurant called Cymbal Bistro. The interesting part is not the chatbot. It is that the whole stack, from tool schemas on the server to rendered widgets on the phone, is Dart.
Four pieces make up the architecture: a Genkit Dart agent, an HTTP endpoint that streams its responses, the A2UI middleware that compiles and validates each UI block, and a Flutter client that renders every block with widgets it already trusts.
The catalog is the security boundary
A2UI works because the agent is not allowed to invent UI. It receives a catalog of approved components and can only compose a layout from that list, starting with the 18-widget Basic Catalog that covers Card, DateTimeInput, ChoicePicker, Slider, Tabs and Modal.
That constraint is what keeps credentials and database writes on the server. The client gets a description of a surface, not markup, so a prompt injection can at worst produce an odd arrangement of cards instead of an arbitrary script execution.
Custom domain components extend the same idea. The sample adds a ConfirmationPass card on the server with two required parameters, then registers the matching Flutter widget under the same catalog id on the client. Both sides have to agree on the name, and neither side can drift without the schema complaining.
- Tool execution stays on the server, so API keys never reach the client binary.
- Catalog validation runs before rendering, so a malformed block becomes a retry rather than a broken screen.
- Styling stays in Flutter, which means themes, accessibility and dark mode behave like the rest of the app.
A reservation that updates in place
The flow is a good demonstration of multi-turn state. When a diner asks for a table, the agent calls checkAvailability and streams a reservation card. When the form is submitted, the client sends an action event and the agent calls confirmReservation.
The second response reuses the same surfaceId, so Flutter replaces the form in place instead of appending another card. That one detail is the difference between a conversation that reads like a chat log and one that behaves like an app.
On the wire, the action travels as a DataPart with the application/a2ui+json media type, carrying the surface id, the source component id, a timestamp and the bound form values. None of that payload is Flutter specific, which is why the same server can feed another client later.
A2UI Express, enabled by default in the 1.0 middleware, compresses generated output to roughly half the size of raw JSON. The middleware also validates each block against the catalog and retries when a model gets the shape wrong. That reliability work never shows up in a demo, and it is the part that decides whether the feature survives contact with production.
- Keep server and client in separate packages so middleware never lands in the app bundle.
- Pin catalog ids on both ends, because a typo fails at render time rather than at compile time.
- Test multi-turn flows in the Genkit Developer UI before wiring a device.
What to copy, and what to skip
The setup is deliberately boring in a useful way. The server is a Shelf router with three mounted routes for streaming, snapshots and cancellation, and the client is a single stateful widget that owns a MessageProcessor and a list of surface ids.
The dependency list is short. On the server it is genkit, genkit_a2ui, genkit_google_genai, genkit_shelf, schemantic, shelf and shelf_router, with build_runner for schema generation. On the client it is genkit, a2ui_flutter, a2ui_core, json_schema_builder and url_launcher. Dart 3.12 or later is the floor.
What the walkthrough cannot give you is a product decision. A generative surface only earns its complexity when the interaction is genuinely structured: picking a time slot, choosing a seating area, confirming an order, adjusting a filter.
For a settings screen or a login form, a hand-written widget is faster, cheaper to test, and easier to reason about six months later. The agent adds value where the shape of the next question depends on the previous answer.
The debugging story is better than most AI demos offer. The Developer UI folds streamed blocks into interactive surfaces, and the Surface Inspector shows the component tree, the active data model and validation status next to a live preview. Simulate Action sends payloads without a device, and the Trace Viewer steps through tool calls when a model picks the wrong one.
Model choice is a config line: gemini-4-hydrogen in the sample, vertexAI.gemini for Cloud deployments, and other providers behind the same interface when a team wants to swap. That portability matters more than any single benchmark, because model pricing moves faster than app release cycles.
The honest caveat is latency. Every turn is a model call plus validation, and a surface that streams in two passes will always feel slower than a local screen. The sample works because a reservation is a short flow with real decisions inside it, not a list to scroll.
If your app has one flow where the next screen depends on what the user just said, this sample is the cheapest way to find out whether generative UI earns its place. The server work is a day. The harder question is whether the experience is better than three well designed screens, and that answer comes from users rather than from a protocol spec.