agentic_client 0.0.3 copy "agentic_client: ^0.0.3" to clipboard
agentic_client: ^0.0.3 copied to clipboard

Dart chat client for rendering A2UI widgets over AGUI protocol

example/lib/main.dart

/// Example app for `agentic_client`.
///
/// Drops [AguiChat] into a Material shell, wired up with a small catalog of
/// custom widgets defined in `catalog.dart`. Point the app at any AG-UI
/// compatible backend with `--dart-define=AGENT_URL=…`; defaults to
/// `http://localhost:8123`.
library;

import 'package:agentic_client/agentic_client.dart';
import 'package:flutter/material.dart';

import 'catalog.dart';

const _backendUrl = String.fromEnvironment(
  'AGENT_URL',
  defaultValue: 'https://cardiac-pork-physical-medium.trycloudflare.com',
);

void main() {
  runApp(const ExampleApp());
}

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'agentic_client example',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
        useMaterial3: true,
        inputDecorationTheme: const InputDecorationTheme(
          border: OutlineInputBorder(),
          isDense: true,
        ),
      ),
      home: const _ChatScreen(),
    );
  }
}

class _ChatScreen extends StatelessWidget {
  const _ChatScreen();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('agentic_client example')),
      body: AguiChat(
        baseUrl: _backendUrl,
        catalog: buildExampleCatalog(),
        catalogDescription: exampleCatalogDescription,
        hintText: 'Try: "show me 3 products" or "weather for Paris"',
      ),
    );
  }
}
1
likes
0
points
88
downloads

Publisher

unverified uploader

Weekly Downloads

Dart chat client for rendering A2UI widgets over AGUI protocol

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

ag_ui, flutter, genai_primitives, genui

More

Packages that depend on agentic_client