Flutter's GenUI Update: Architectural Shift and Enhanced LLM Control

By ✦ min read

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.

Flutter's GenUI Update: Architectural Shift and Enhanced LLM 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:

  1. 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 your pubspec.yaml.
  2. 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 the A2uiTransportAdapter. This gives you full control over retries and error handling.
  3. Wire up the new layers: Instantiate a SurfaceController to manage the UI, a Conversation facade for state tracking, and a TransportAdapter to 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.

Tags:

Recommended

Discover More

How to Recreate Life's Spark: A Guide to Freeze-Thaw Chemistry with Lipid MembranesOcean DNA Reveals Secret World of Deep-Sea Giants Off Western AustraliaBreakthrough: Generalized Language Models Now See and Describe Images Without Specialized Vision NetworksPython 3.15.0 Alpha 1: A Developer Preview GuideHow to Infuse a Video Game Villain with Comedic Charm: Lessons from Matt Berry’s Bane in Lego Batman