a2ui_flutter
0.4.0, released 3 days ago by labs.flutter.dev
Renders AI-generated A2UI surfaces as Flutter widgets.
What it does
A2UI Flutter parses JSON-based UI messages generated by AI agents and renders them as standard Flutter widgets. It includes the basic catalog of components like lists, buttons, text, and inputs to quickly construct dynamically generated user interfaces.
AI-written summary of version 0.4.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are building an app driven by an AI agent that dynamically designs user interfaces.
- You want to render A2UI protocol v1.0 or v0.9 surfaces inside a Flutter app.
Skip it when
- You are building a standard application with a pre-designed, static UI structure.
- You do not use an A2UI-compliant backend or agent.
Strengths
- Provides built-in basic component catalog using Material widgets.
- Supports dynamic data bindings and reactivity out of the box.
Weaknesses
- Requires careful security handling when working with untrusted AI agents.
- Network images and media on macOS require specific entitlements.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
Add a2ui_flutter and a2ui_core to pubspec.yaml. On macOS, network images and media need the com.apple.security.network.client entitlement.
import 'package:a2ui_core/a2ui_core.dart';
import 'package:a2ui_flutter/a2ui_flutter.dart';
import 'package:a2ui_flutter/basic_catalog.dart';
import 'package:flutter/material.dart';
void main() => runApp(const MaterialApp(home: HelloA2ui()));
class HelloA2ui extends StatefulWidget {
const HelloA2ui({super.key});
@override
State<HelloA2ui> createState() => _HelloA2uiState();
}
class _HelloA2uiState extends State<HelloA2ui> {
final processor = MessageProcessor<ComponentImplementation>(
catalogs: [basicCatalog()],
);
SurfaceModel<ComponentImplementation>? surface;
@override
void initState() {
super.initState();
processor.model.onSurfaceCreated.subscribe(
(created) => setState(() => surface = created),
);
}
@override
void dispose() {
processor.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final SurfaceModel<ComponentImplementation>? surface = this.surface;
return Scaffold(
body: surface == null ? null : A2uiSurface(surface: surface),
);
}
}Alternatives
Packages that do the same job and could replace a2ui_flutter.
- jaspr
A web framework for building websites in Dart with Flutter-like syntax and server-side rendering.
92Compare - stac
A Server-Driven UI framework for Flutter that renders JSON payloads into native widgets.
87Compare - stac_core
Core library for the Stac server‑driven UI framework, providing models, interfaces, and utilities.
80Compare - bones_ui
An intuitive and user-friendly Web User Interface framework for Dart.
73Compare
Works with
Packages commonly used together with a2ui_flutter: ones it builds on, ones built on it, and its own family.
- path_parsinga2ui_flutter depends on itPure Dart library for parsing SVG path strings and generating Dart path code.
- video_playera2ui_flutter depends on itFlutter plugin for displaying inline video on Android, iOS, macOS, and web.
- a2ui_corea2ui_flutter depends on itFramework-agnostic Dart SDK for the A2UI protocol supporting messages, data binding, and state models.
- genuiSame familyGenerates and displays dynamic user interfaces in Flutter using AI.