Skip to content
pubscout

a2ui_flutter

0.4.0, released 3 days ago by labs.flutter.dev

Renders AI-generated A2UI surfaces as Flutter widgets.

WASM-ready
$ flutter pub add a2ui_flutter
Source repository

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.

  • stac

    A Server-Driven UI framework for Flutter that renders JSON payloads into native widgets.

  • stac_core

    Core library for the Stac server‑driven UI framework, providing models, interfaces, and utilities.

  • bones_ui

    An intuitive and user-friendly Web User Interface framework for Dart.

Works with

Packages commonly used together with a2ui_flutter: ones it builds on, ones built on it, and its own family.