You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[flutter_genui](packages/flutter_genui/)| (work in progress) A framework to employ Generative UI. |[](https://pub.dev/packages/flutter_genui)|
113
-
|[dart_schema_builder](packages/dart_schema_builder/)| (work in progress) A fully featured Dart JSON Schema package with validation. |[](https://pub.dev/packages/dart_schema_builder)|
Copy file name to clipboardExpand all lines: packages/flutter_genui/README.md
+12-4Lines changed: 12 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,14 @@ A Flutter package for building dynamic, conversational user interfaces powered b
4
4
5
5
`flutter_genui` allows you to create applications where the UI is not static or predefined, but is instead constructed by an AI in real-time based on a conversation with the user. This enables highly flexible, context-aware, and interactive user experiences.
6
6
7
+
This package provides the core functionality for GenUI. For a concrete implementation that uses Firebase AI, see the `flutter_genui_firebase_ai` package.
8
+
7
9
## Features
8
10
9
11
-**Dynamic UI Generation**: Render Flutter UIs from structured data returned by a generative AI.
10
12
-**Simplified Conversation Flow**: A high-level `UiAgent` facade manages the interaction loop with the AI.
11
13
-**Customizable Widget Catalog**: Define a "vocabulary" of Flutter widgets that the AI can use to build the interface.
12
-
-**Extensible AI Client**: Abstract interface for connecting to different AI model backends. A ready-to-use `GeminiAiClient` for Firebase is included.
14
+
-**Extensible AI Client**: Abstract interface for connecting to different AI model backends.
13
15
-**Event Handling**: Capture user interactions (button clicks, text input) and send them back to the AI as context for the next turn in the conversation.
14
16
15
17
## Core Concepts
@@ -20,7 +22,7 @@ The package is built around three main components:
20
22
21
23
2.**`Catalog`**: A collection of `CatalogItem`s that defines the set of widgets the AI is allowed to use. Each `CatalogItem` specifies a widget's name (for the AI to reference), a data schema for its properties, and a builder function to render the Flutter widget.
22
24
23
-
3.**`AiClient`**: An interface for communicating with a generative AI model. The package includes `GeminiAiClient` for interacting with Gemini models via the [Firebase AI Logic SDK](https://pub.dev/packages/firebase_ai).
25
+
3.**`AiClient`**: An interface for communicating with a generative AI model. For a concrete implementation, see `FirebaseAiClient` in the `flutter_genui_firebase_ai` package.
24
26
25
27
## Getting Started
26
28
@@ -29,6 +31,7 @@ To use `flutter_genui`, you need to initialize a `UiAgent`, provide it with a sy
Copy file name to clipboardExpand all lines: packages/flutter_genui/USAGE.md
+16-6Lines changed: 16 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,17 +42,21 @@ If `flutterfire configure` fails, try one or all of these:
42
42
43
43
### Employ `flutter_genui`
44
44
45
-
For a complete example, refer to [main.dart in the minimal_genui example](../../examples/minimal_genui/lib/main.dart). The following steps outline the details of setting up your project to use `flutter_genui`:
45
+
For a complete example, refer to [main.dart in the simple_chat example](../../examples/simple_chat/lib/main.dart). The following steps outline the details of setting up your project to use `flutter_genui`:
46
46
47
-
1. In your `pubspec.yaml` file, add `flutter_genui` to the `dependencies` section with one of the following options:
47
+
1. In your `pubspec.yaml` file, add `flutter_genui`and `flutter_genui_firebase_ai`to the `dependencies` section with one of the following options:
48
48
49
49
- Reference the github project directly:
50
50
51
51
```yaml
52
52
flutter_genui:
53
-
git:
54
-
url: https://github.com/flutter/genui.git
55
-
path: packages/flutter_genui
53
+
git:
54
+
url: https://github.com/flutter/genui.git
55
+
path: packages/flutter_genui
56
+
flutter_genui_firebase_ai:
57
+
git:
58
+
url: https://github.com/flutter/genui.git
59
+
path: packages/flutter_genui_firebase_ai
56
60
```
57
61
58
62
- In the future: download from [pub.dev](https://pub.dev)! (We're not ready to publish this as a package until the API is more stable.)
@@ -72,8 +76,14 @@ For a complete example, refer to [main.dart in the minimal_genui example](../../
72
76
@override
73
77
void initState() {
74
78
super.initState();
79
+
final genUiManager = GenUiManager(catalog: CoreCatalogItems.asCatalog());
80
+
final aiClient = FirebaseAiClient(
81
+
systemInstruction: 'You are a helpful AI assistant.',
0 commit comments