Flutter's GenUI Update: Architectural Shift and Enhanced LLM Control
Introduction
Generative UI (GenUI) is a design pattern where an AI agent not only generates content but also decides how to display and make it interactive. For Flutter developers, this is implemented via the A2UI protocol—an open standard that coordinates between agents and renderers to compose and manage UI state. The Flutter team's genui package builds on A2UI, connecting agents with a catalog of widgets and presenting them to users. Recently, both the genui package and the A2UI protocol received major updates, introducing significant architectural changes that give developers more flexibility and control.
What's New in the Latest Release?
The latest version of genui (v0.9.0) shifts the framework from a Structured Output First approach to a Prompt First philosophy. In earlier versions, A2UI messages were streamed through structured output APIs. Now, agents embed blocks of JSON directly in their text responses, simplifying integration. Additionally, the architecture has been decoupled, providing direct control over interactions with Large Language Models (LLMs).
From Structured Output to Prompt First
Previously, the framework relied on structured output APIs to enforce message formats. This required all agents to generate JSON in a specific schema. With the Prompt First shift, agents now produce JSON as part of their natural language responses. This reduces constraints on agent behavior and makes it easier to experiment with different LLMs and prompts.
Architecture Decoupling
In v0.7.0, genui used a ContentGenerator class that wrapped LLM interactions—handling prompt construction, network calls, and response parsing behind the scenes. The latest release removes ContentGenerator entirely. The framework is now split into three distinct layers:
- Engine (SurfaceController): Manages UI state and rendering.
- Transport (A2uiTransportAdapter): Handles streaming messages between the agent and renderer.
- Facade (Conversation): Provides a high-level API for managing chat states.
This decoupling empowers developers to control chat history, retry logic, and error handling directly. You can now set up your LLM connection however you like—choose any model or provider, tweak generation settings, add custom functions—without going through a framework wrapper.
How the New GenUI Framework Works
The layered design gives you direct ownership of the agent interaction. Instead of passing a ContentGenerator to the SurfaceController, your app now sets up a connection to an agent and passes messages via a TransportAdapter. The Conversation facade wraps common chat operations, while the SurfaceController reacts to incoming widget definitions. This separation of concerns makes the code easier to test, maintain, and scale.
Migrating from v0.7.0 to v0.9.0
If you're upgrading an existing app, here are the key steps:
- Remove old dependencies: The provider-specific wrapper packages (e.g.,
genui_dartantic,genui_google_generative_ai,genui_firebase_ai) no longer exist. Clean them from yourpubspec.yaml. - Rewrite the chat loop: Instead of relying on
ContentGenerator, create a function that sends queries to your LLM, receives the response, and passes it to theA2uiTransportAdapter. This gives you full control over retries and error handling. - Wire up the new layers: Instantiate a
SurfaceControllerto manage the UI, aConversationfacade for state tracking, and aTransportAdapterto stream messages.
For detailed examples, check the official migration guide on the Flutter website.
Benefits of the New Architecture
Removing the ContentGenerator wrapper eliminates vendor lock-in. You can now use any LLM (OpenAI, Claude, Gemini, etc.) with your own prompts and parameters. The decoupled layers also make it easier to implement advanced features like conversation branching, streaming responses, and custom UI components. Developers gain finer control over performance, latency, and cost by choosing their own model endpoints.
Overall, the update transforms GenUI from a black-box implementation into a flexible, developer-friendly framework. The architecture decoupling and shift to Prompt First are especially beneficial for teams building interactive AI-powered interfaces in Flutter.
Conclusion
Flutter's GenUI package and the underlying A2UI protocol have evolved to give developers more power and flexibility. By moving to a Prompt First approach and decoupling the architecture, the Flutter team has unlocked greater control over LLM interactions. Whether you're building a simple chatbot or a complex AI-driven UI, these updates make it easier to customize and scale your generative UI solutions. Upgrade today and experience the difference.
Related Articles
- Cloudflare Unleashes Autonomous AI Agents to Deploy Apps with Zero Human Intervention
- How to Build a Trust Infrastructure for AI Resilience: A 9-Step Guide from VeeamON Insights
- 8 Key Updates on the Python Security Response Team You Need to Know
- Spotify Engineers Unveil Revolutionary AI-Powered Ads Manager Built with Claude Plugins
- Code's Dual Identity: Instructions and Conceptual Models as AI Agents Take Over Programming
- How to Automate Intellectual Toil with Agent-Driven Development on GitHub Copilot
- Exploring the September 2025 Update for Python in Visual Studio Code: New AI Features and Environment Enhancements
- 10 Crucial Facts About GitHub's Post-Quantum SSH Security Upgrade