Skip to content

Commit 535e3fc

Browse files
authored
Use 'dart pub add' on GenUI get started page (#12728)
1 parent ac50e99 commit 535e3fc

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

src/content/ai/genui/get-started.md

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,13 @@ The main components in this package include:
178178
179179
Follow these instructions:
180180
181-
1. Add the following to your `pubspec.yaml` file:
182-
183-
```yml
184-
dependencies:
185-
flutter:
186-
sdk: flutter
187-
genui: ^latest_version # Replace with the actual latest version
188-
genui_a2ui: ^latest_version # Replace with the actual latest version
189-
a2a: ^latest_version # Replace with the actual latest version
190-
```
181+
1. Set up dependencies:
182+
Use `dart pub add` to add `genui`, `genui_a2ui`, and `a2a` as
183+
dependencies in your `pubspec.yaml` file.
191184
192-
Then run `flutter pub get`.
185+
```console
186+
$ dart pub add genui genui_a2ui a2a
187+
```
193188
194189
2. Initialize `GenUIManager`:
195190
Set up `GenUiManager` with your widget `Catalog`.
@@ -215,7 +210,7 @@ Follow these instructions:
215210
import 'package:logging/logging.dart';
216211
217212
void main() {
218-
// Setup logging
213+
// Setup logging.
219214
Logger.root.level = Level.ALL;
220215
Logger.root.onRecord.listen((record) {
221216
print('${record.level.name}: ${record.time}: ${record.message}');
@@ -264,24 +259,25 @@ Follow these instructions:
264259
void initState() {
265260
super.initState();
266261
_contentGenerator = A2uiContentGenerator(
267-
serverUrl: Uri.parse('http://localhost:8080'), // Replace with your A2A server URL
262+
// TODO: Replace with your A2A server URL.
263+
serverUrl: Uri.parse('http://localhost:8080'),
268264
);
269265
_uiAgent = GenUiConversation(
270266
contentGenerator: _contentGenerator,
271267
genUiManager: _genUiManager,
272268
);
273269
274-
// Listen for text responses from the agent
270+
// Listen for text responses from the agent.
275271
_contentGenerator.textResponseStream.listen((String text) {
276272
setState(() {
277273
_messages.insert(0, AgentMessage.text(text));
278274
});
279275
});
280276
281-
// Listen for errors
277+
// Listen for errors.
282278
_contentGenerator.errorStream.listen((ContentGeneratorError error) {
283279
print('Error from ContentGenerator: ${error.error}');
284-
// Optionally show error to the user
280+
// Optionally show the error to the user.
285281
});
286282
}
287283
@@ -326,13 +322,14 @@ Follow these instructions:
326322
decoration: BoxDecoration(color: Theme.of(context).cardColor),
327323
child: _buildTextComposer(),
328324
),
329-
// Surface for the main AI-generated UI
325+
// Surface for the main AI-generated UI:
330326
SizedBox(
331-
height: 300,
332-
child: GenUiSurface(
333-
host: _genUiManager,
334-
surfaceId: 'main_surface',
335-
)),
327+
height: 300,
328+
child: GenUiSurface(
329+
host: _genUiManager,
330+
surfaceId: 'main_surface',
331+
),
332+
),
336333
],
337334
),
338335
);
@@ -384,8 +381,9 @@ Follow these instructions:
384381
Container(
385382
margin: const EdgeInsets.symmetric(horizontal: 4.0),
386383
child: IconButton(
387-
icon: const Icon(Icons.send),
388-
onPressed: () => _handleSubmitted(_textController.text)),
384+
icon: const Icon(Icons.send),
385+
onPressed: () => _handleSubmitted(_textController.text),
386+
),
389387
),
390388
],
391389
),
@@ -401,8 +399,6 @@ complete application demonstrating how to use this package.
401399
[example]: {{site.pub-pkg}}/genui_a2ui/example
402400
[A2UI Streaming UI Protocol]: https://a2ui.org/
403401
404-
[A2UI Streaming UI Protocol]: https://a2ui.org/
405-
406402
</Tab>
407403
408404
<Tab name="Build your own">

0 commit comments

Comments
 (0)