genui
0.10.4, released 8 weeks ago by labs.flutter.dev
Generates and displays dynamic user interfaces in Flutter using AI.
What it does
GenUI allows you to build dynamic, conversational user interfaces where the UI is constructed by an AI in real-time based on conversations with the user. It provides a Conversation facade, customizable widget catalogs, reactive data models, and transport adapters to handle incoming A2UI message streams.
AI-written summary of version 0.10.4, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to build applications where the UI is generated dynamically by an LLM or AI agent.
- You need a conversational UI that can update components and data models on the fly.
Skip it when
- Your application requires a completely static, pre-defined user interface.
- You are not using an AI model or backend to generate dynamic UI definitions.
Strengths
- Enables real-time, context-aware, and interactive generative user interfaces.
- Flexible backend-agnostic design with custom widget catalogs and reactive data binding.
Weaknesses
- Relies heavily on external LLM response reliability and structured streaming.
- Requires custom bridge implementation for your specific AI agent provider.
Setup
- Kind
- Flutter widgets
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 14
Requires adding network client entitlements for iOS or macOS if making outbound network requests, and implementing an AI transport adapter.
class _MyHomePageState extends State<MyHomePage> {
late final SurfaceController _controller;
late final A2uiTransportAdapter _transport;
late final Conversation _conversation;
@override
void initState() {
super.initState();
_controller = SurfaceController(catalogs: [CoreCatalogItems.asCatalog()]);
_transport = A2uiTransportAdapter(onSend: _onSendToLLM);
_conversation = Conversation(controller: _controller, transport: _transport);
}
Future<void> _onSendToLLM(ChatMessage message) async {
final responseStream = myLlmClient.streamGenerateContent(message);
await for (final chunk in responseStream) {
_transport.addChunk(chunk);
}
}
}Works with
Packages commonly used together with genui: ones it builds on, ones built on it, and its own family.
- uuidgenui depends on itGenerates and parses RFC‑4122/9562 UUIDs (v1‑v8) for Dart.
- intlgenui depends on itA Dart library for internationalization and localization, providing message translation, plural/gender handling, and date/number formatting.
- logginggenui depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- url_launchergenui depends on itFlutter plugin for launching URLs across mobile, desktop, and web platforms.
- stream_transformgenui depends on itExtension methods adding common stream transform operators
- video_playergenui depends on itFlutter plugin for displaying inline video on Android, iOS, macOS, and web.
- audioplayersgenui depends on itA Flutter plugin to play multiple audio files simultaneously
- flutter_markdown_plusgenui depends on itA Markdown renderer widget for Flutter to display rich text from plain text data.