Flutter GenUI lets an AI agent answer with your own widgets instead of text. Most AI features in Flutter apps still return a paragraph of text in a chat bubble. Flutter's GenUI SDK changes that. The agent answers with your own widgets, such as a product carousel or a trip-planning form, and the user taps their way through instead of typing. I have built AI features into Flutter apps like TourVista, Nest AI and Fluently AI, and generative UI changes what the screen does, not just what it says. This guide explains how GenUI works, walks through the current API with a small example, and gives my honest view on when the alpha package is worth using.
Written against genui 0.10.4, the latest release on pub.dev as of October 24, 2026. The package is alpha, so check the changelog before you copy code.
What is Flutter GenUI?
Flutter GenUI (the genui package, published by labs.flutter.dev) is an alpha SDK from the Flutter team that lets an AI agent reply with native Flutter widgets from a catalog you define, using Google's A2UI JSON protocol. The official GenUI docs call it "an orchestration layer": a suite of packages that "coordinates the flow of information between your user, your Flutter widgets, and an AI agent".
The docs say GenUI uses a JSON-based format to compose a UI from your existing widget catalog. According to the Flutter blog, the agent "uses tools provided by the GenUI SDK to describe the UI", and the SDK receives the response, deserializes it and builds the matching widgets. When the user interacts, state changes go back to the agent, which the docs describe as "a high-bandwidth loop".
The Flutter docs give two examples that make the idea concrete:
- Shopping: render a clickable product carousel instead of a text list of products.
- Travel: when a user asks to plan a trip, generate a complete form with sliders, date pickers and text fields.
GenUI was announced in alpha on the Flutter blog on November 18, 2025. The same post says it generates UI with "Gemini (or other LLMs)" that "adheres to your established brand guidelines", because you define your own custom widgets for it to use.
What is the A2UI protocol and how does GenUI use it?
A2UI is the JSON format the agent uses to describe UI, and GenUI is the Flutter renderer for it. According to a2ui.org, A2UI is an Apache 2.0 protocol created by Google, with contributions from CopilotKit, that lets agents generate interfaces that render natively on web, mobile and desktop. Renderers exist for Flutter, Angular and Lit.
The Flutter team developed the SDK around A2UI together with Google's A2A team and the Opal team at Google Labs. A few details worth knowing:
- Version support. As of October 24, 2026, the flutter/genui repo states that the SDK currently supports A2UI v0.9. On a2ui.org, v0.9.1 is the current release and v1.0 is a release candidate.
- Message types. The v0.9 messages GenUI handles are
createSurface,updateComponents,updateDataModelanddeleteSurface. You may see older names in some docs pages; these are the ones in the currenta2ui_coresource. - Security model. A2UI is a declarative data format, not executable code, and agents can only use pre-approved components from the client's catalog.
What are the core pieces of the GenUI API?
The current GenUI API has four names you need to know: Conversation as the entry point, SurfaceController for state, A2uiTransportAdapter for parsing model output, and the Surface widget for rendering. Your Catalog of CatalogItems defines what the AI is allowed to draw.
| Class | What it does |
|---|---|
Conversation | Primary facade. Sends requests with sendRequest, exposes an events stream and a state listenable with surfaces, latestText and isWaiting. |
SurfaceController | Processes A2UI messages, manages the DataModel and surface state. Accepts one or more catalogs. |
A2uiTransportAdapter | Bridge that parses raw text streamed from your LLM into A2uiMessage commands. |
Surface | The widget that renders one surface the agent created. |
Catalog / CatalogItem | The set of widgets the AI may use. Each item is a name, a data schema and a widget builder. |
DataModel | Central observable store for UI state. Only widgets bound to a changed value rebuild. |
If you read older tutorials, the names will not match. According to the genui changelog on pub.dev, version 0.7.0 renamed GenUiConversation to Conversation, GenUiController to SurfaceController and GenUiSurface to Surface. Version 0.8.0 renamed CoreCatalog to BasicCatalog. Version 0.10.0 removed SurfaceController.store; use contextFor(id).dataModel instead.
GenUI vs Flutter AI Toolkit vs plain LLM text: which do you need?
Use GenUI when the answer should be an interface, the Flutter AI Toolkit when you want a ready-made chat window, and plain LLM text when a sentence is enough.
GenUI (genui) | Flutter AI Toolkit (flutter_ai_toolkit) | Plain LLM text | |
|---|---|---|---|
| What it renders | Widgets from your catalog, composed by the model in A2UI JSON | Chat widgets: multiturn chat, streaming responses, voice input, attachments and custom response widgets | Text or Markdown inside widgets you build |
| Who controls the layout | The model, limited to the catalog you define | You; the toolkit supplies the chat UI | You |
| Maturity (October 24, 2026) | Alpha, 0.10.4 on pub.dev | 1.0.0 on pub.dev, published December 15, 2025 | Depends on your LLM SDK |
| Best use | Forms, cards and pickers the user taps through | An assistant chat screen | Answers, summaries, short replies |
Which backend should you connect GenUI to?
Use Firebase AI Logic for a serverless client app, genui_a2a when the agent lives on your server, and a custom A2uiTransportAdapter for any other LLM or proxy. Those are the three agent options in the get-started guide, which describes Firebase AI Logic as "useful for production apps where interactions with the LLM are all in your Flutter client, without requiring a server".
| Option | Install | Where the agent runs | Good fit |
|---|---|---|---|
| Firebase AI Logic | dart pub add genui firebase_ai | In the app; Firebase manages the Gemini API key | Production apps where every LLM call happens in the Flutter client (the docs' description) |
| A2UI server | dart pub add genui genui_a2a | Your server, connected with A2uiAgentConnector | Agents with tools, private data or shared logic across clients |
| Custom adapter | No single command; follow your LLM provider's SDK docs | Wherever your LLM call lives | Existing LLM backends and proxies |
The older adapter packages genui_firebase_ai, genui_google_generative_ai and genui_dartantic are discontinued on pub.dev, and genui_a2ui is discontinued in favour of genui_a2a. The current docs use firebase_ai directly.
My own preference differs from the docs on one point: Firebase AI Logic is the fastest way to prototype, but I lean towards the server or custom adapter route so the prompt, model choice and API keys stay on a backend I control. I explain that reasoning in why you should stop hardcoding LLM API keys in Flutter.
How do you set up generative UI in Flutter with GenUI?
Add the packages, make sure your Flutter and Dart versions are new enough, allow outbound network access on Apple platforms, and wire three objects together. As of October 24, 2026, genui 0.10.4 needs Dart >=3.10.0 and Flutter >=3.35.7, and pub.dev lists Android, iOS, macOS and web as supported platforms.
- Install. For the Firebase route, run
dart pub add genui firebase_ai. You also need a Firebase project with the Gemini API enabled, the Firebase Flutter setup done, andFirebase.initializeAppcalled inmain. - Check Apple minimums. Firebase's minimum iOS and macOS versions can be higher than Flutter's defaults, so check your
Podfile(iOS) andCMakeLists.txt(macOS). - Allow network access. Add the client network entitlement to
{ios,macos}/Runner/*.entitlements. - Turn on logging. GenUI uses
package:logging, which helps a lot when the model sends JSON your catalog rejects.
The client network entitlement for {ios,macos}/Runner/*.entitlements:
<key>com.apple.security.network.client</key>
<true/>
Turn on GenUI logging and print every record:
final logger = configureLogging(level: Level.ALL);
logger.onRecord.listen((record) {
debugPrint('${record.loggerName}: ${record.message}');
});
How do you add your own widget to the GenUI catalog?
You create a CatalogItem with a name, a JSON schema built with json_schema_builder, and a widgetBuilder, then add it to a catalog with copyWith(newItems: [...]). The schema tells the model what data the widget accepts; the builder turns that data into your real Flutter widget.
The trip-planner example in this guide starts with a destination card. Add the schema package with dart pub add json_schema_builder. This catalog item renders a card and sends a planTrip event when tapped:
import 'package:flutter/material.dart';
import 'package:genui/genui.dart';
import 'package:json_schema_builder/json_schema_builder.dart';
final destinationCard = CatalogItem(
name: 'DestinationCard',
dataSchema: S.object(
properties: {
'name': S.string(description: 'Destination name'),
'summary': S.string(description: 'One-sentence reason to go'),
},
required: ['name', 'summary'],
),
widgetBuilder: (itemContext) {
final data = itemContext.data as Map<String, Object?>;
final name = data['name'] as String;
return Card(
child: ListTile(
title: Text(name),
subtitle: Text(data['summary'] as String),
trailing: TextButton(
child: const Text('Plan this trip'),
onPressed: () => itemContext.dispatchEvent(
UserActionEvent(
name: 'planTrip',
sourceComponentId: itemContext.id,
context: {'destination': name},
),
),
),
),
);
},
);
final tripCatalog =
BasicCatalogItems.asCatalog().copyWith(newItems: [destinationCard]);
The docs sample imports package:material_ui; I use package:flutter/material.dart, as the package's own widgets do. It works on stable Flutter today, but the changelog on main says genui ignores the deprecation of package:flutter/material.dart on Flutter beta until it can migrate to package:material_ui. Note that copyWith takes the named newItems parameter.
BasicCatalogItems already includes a button, card, checkbox, column, row, date-time input, slider, text field, text, tabs, list, modal, choice picker, icon, image, audio player and video. Use asNoAssetCatalog() to drop the image, audio and video items. The docs note that production apps usually define their own catalog, and I agree: the catalog is your design system for the agent, so it belongs next to your other UI components, the same way I keep views separate from logic in MVVM for Flutter.
How do you wire GenUI to Gemini with Firebase AI Logic?
Create a SurfaceController with your catalog, an A2uiTransportAdapter whose onSend calls the model, and a Conversation that joins them. Build the system prompt with PromptBuilder.chat, because the model only uses GenUI's components if the system instructions tell it to.
Minimal Firebase AI Logic wiring for GenUI 0.10.x:
import 'package:firebase_ai/firebase_ai.dart' as ai;
import 'package:flutter/material.dart';
import 'package:genui/genui.dart';
class TripPlannerPage extends StatefulWidget {
const TripPlannerPage({super.key});
@override
State<TripPlannerPage> createState() => _TripPlannerPageState();
}
class _TripPlannerPageState extends State<TripPlannerPage> {
final _textController = TextEditingController();
late final SurfaceController _surfaceController;
late final A2uiTransportAdapter _transportAdapter;
late final Conversation _conversation;
late final ai.ChatSession _chat;
@override
void initState() {
super.initState();
final promptBuilder = PromptBuilder.chat(
catalog: tripCatalog,
systemPromptFragments: [
'You are a trip planner. Suggest destinations as DestinationCard '
'components. When the user picks one, build a planning form.',
],
);
final model = ai.FirebaseAI.vertexAI().generativeModel(
model: 'gemini-3.5-flash', // model id from the docs sample
systemInstruction:
ai.Content.system(promptBuilder.systemPromptJoined()),
);
_chat = model.startChat();
_surfaceController = SurfaceController(catalogs: [tripCatalog]);
_transportAdapter = A2uiTransportAdapter(onSend: _send);
_conversation = Conversation(
controller: _surfaceController,
transport: _transportAdapter,
);
}
Future<void> _send(ChatMessage message) async {
// Typed text plus any button or form interactions from surfaces.
final prompt = [
message.text,
...message.parts.uiInteractionParts.map((p) => p.interaction),
].join('\n');
await for (final chunk
in _chat.sendMessageStream(ai.Content.text(prompt))) {
_transportAdapter.addChunk(chunk.text ?? '');
}
}
@override
Widget build(BuildContext context) {
return Column(
children: [
Expanded(
child: ValueListenableBuilder<ConversationState>(
valueListenable: _conversation.state,
builder: (context, state, _) => ListView(
children: [
for (final id in state.surfaces)
Surface(surfaceContext: _surfaceController.contextFor(id)),
],
),
),
),
TextField(
controller: _textController,
onSubmitted: (text) {
_conversation.sendRequest(ChatMessage.user(text));
_textController.clear();
},
),
],
);
}
@override
void dispose() {
_textController.dispose();
_conversation.dispose();
_transportAdapter.dispose();
_surfaceController.dispose();
super.dispose();
}
}
The dispose order matches the docs sample. Check the model id against the models your Firebase project offers before you ship. If you have not called Gemini from Flutter before, my guide on integrating ChatGPT and Gemini into a Flutter app covers streaming and error handling in more depth.
How do you connect GenUI to an A2UI server with genui_a2a?
With genui_a2a, the agent runs on your server and the app connects with A2uiAgentConnector. You still create a SurfaceController, a transport adapter and a Conversation, then pipe the connector's streams into the transport adapter and send messages through the connector from the adapter's onSend. This is the wiring from the genui_a2a README on pub.dev:
_connector = A2uiAgentConnector(
url: Uri.parse('https://your-agent.example.com'),
);
_transport = A2uiTransportAdapter(onSend: _sendMessageToAgent);
_connector.stream.listen(_transport.addMessage);
_connector.textStream.listen(_transport.addChunk);
Future<void> _sendMessageToAgent(ChatMessage message) async {
await _connector.connectAndSend(message);
}
Dispose the connector with the other controllers. The repo's examples/verdure landscape-design demo shows this route with a Python A2A/ADK server.
How do user taps and form inputs get back to the agent?
Widgets read their state from the DataModel, and user actions travel back to the agent as events. Surface captures an action, SurfaceController turns it into a user message, and Conversation sends it. Only the context the AI defined for that action is sent, not the whole data model.
- Binding. The
DataModelis a centralized, observable store. Widgets are bound to data in it, and when data changes only the widgets that depend on that piece rebuild.SliderandTextFieldfall back to their literal value until their bound path holds something. The 0.10.5 entry on the main-branch changelog (not yet on pub.dev as of October 24, 2026) givesCheckBoxthe same fallback. - Events. A custom widget calls
itemContext.dispatchEvent(UserActionEvent(...)), with the event's context resolved from the data model. The action carries a name, surface ID, source component ID, context and timestamp;Surfacefills in the surface ID and hands the event toSurfaceController.handleUiEvent. - The loop.
handleUiEventwraps the action in an{'action': ...}JSON envelope and emits aUserUiInteractionMessageononSubmit, whichConversationlistens to and forwards withsendRequest.
agent --A2UI JSON--> SurfaceController --> Surface (your widgets)
^ |
| user taps
| v
Conversation.sendRequest <-- onSubmit <-- UserActionEvent
In the trip planner, tapping "Plan this trip" sends planTrip with the destination in its context, and the agent replies with a new surface: dates, a budget slider and a text field for notes.
Is Flutter GenUI production ready?
Not yet. The Flutter docs say "the genui package is in alpha and is likely to change", and the GitHub repo calls it "a highly experimental package, which means the API will change (sometimes drastically)". Two unreleased entries on the main-branch changelog, neither on pub.dev as of October 24, 2026, show where it is heading: 0.10.5 announces a redesign into a2ui_core, a2ui_agent and a2ui_flutter, and 0.10.6 inlines a2ui_core into genui as package:genui/a2ui_core.dart, marked as a breaking change.
The package is active, though. genui 0.10.4 was published on pub.dev on September 29, 2026 by the verified publisher labs.flutter.dev. My view on when to use it today:
- Worth it: internal tools, prototypes, demos for investors, and contained features like a "suggest a plan" panel where a broken response is an annoyance, not a lost sale.
- Not yet: checkout flows, onboarding, anything regulated, or core screens your retention depends on.
- If you ship it anyway: pin exact versions, keep GenUI behind your own small interface so the coming API change touches one folder, and keep a non-AI fallback screen.
For how a feature like this fits into a full AI-assisted build, from first prompt to store release, see how to build a Flutter app with AI in 2026. If an AI coding agent writes your catalog items and wiring, my Claude Code guide for Flutter developers covers how to set it up so it follows your project's patterns.
Frequently Asked Questions
Which platforms does Flutter GenUI support?
As of October 24, 2026, pub.dev lists Android, iOS, macOS and web for genui 0.10.4. On iOS and macOS you also need the client network entitlement, and with Firebase you may need to raise the minimum OS version in your Podfile or CMakeLists.txt.
What is A2UI?
A2UI is an Apache 2.0 protocol, created by Google with contributions from CopilotKit, that lets agents describe interfaces as declarative JSON that renders natively. Renderers exist for Flutter, Angular and Lit, and GenUI is the Flutter one.
Which LLMs work with GenUI?
The docs use Gemini through firebase_ai (Firebase AI Logic). You can also run an agent on your own server and connect it with genui_a2a, or build your own adapter for your preferred LLM provider that streams its text into A2uiTransportAdapter. The model needs GenUI's system prompt to know which components it may use.
What replaced GenUiConversation and GenUiController?
Version 0.7.0 renamed GenUiConversation to Conversation, GenUiController to SurfaceController and GenUiSurface to Surface. Version 0.8.0 renamed CoreCatalog to BasicCatalog, and 0.10.0 removed SurfaceController.store in favour of contextFor(id).dataModel. If an old tutorial no longer compiles, these renames are the usual cause.
Do I need a server to use GenUI in Flutter?
No. With Firebase AI Logic, the agent runs client-side and Firebase manages the Gemini API key, so you need a Firebase project but no server of your own. If you want the agent on your backend, use genui_a2a with an A2UI server or write a custom adapter.
Is it safe to let an AI generate UI in my app?
A2UI is declarative data, not executable code, and the agent can only use components from your catalog, so it cannot run arbitrary code in your app. You still need to validate what your widgets do with model-supplied data, and keep payments and destructive actions behind your own confirmation logic.
Which packages replaced genui_firebase_ai and genui_a2ui?
genui_firebase_ai, genui_google_generative_ai and genui_dartantic are discontinued on pub.dev; the current docs use firebase_ai directly with A2uiTransportAdapter. genui_a2ui is discontinued and replaced by genui_a2a, whose A2uiAgentConnector connects your app to an A2UI server.
Why does my GenUI app fail to reach the network on macOS or iOS?
Apple sandboxing blocks outbound requests unless the app has the client network entitlement. Add the com.apple.security.network.client key set to true in your ios and macos Runner entitlements files. If you use Firebase, also check that your Podfile and CMakeLists.txt meet Firebase's minimum OS versions.
Does GenUI work with small or on-device models?
It can, but watch the prompt size. The get-started guide warns that PromptBuilder.chat() can produce a system prompt of 3,000 to 5,000 or more tokens, which may exceed a small model's context. Write a compact custom prompt covering only createSurface and updateComponents, or pass just the schema parts you need.
About the author: Afaq Zahir is a freelance Flutter developer who has built AI features into apps such as TourVista, Nest AI and Fluently AI.
If you want generative UI or another AI feature built into your Flutter app with a secure backend and a fallback plan for alpha packages, see my Flutter AI development service or get in touch.