Skip to content

Commit 8f1c4f4

Browse files
committed
Fixing typo
1 parent 98b1edb commit 8f1c4f4

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • packages/genui/skills/create-catalog-item

packages/genui/skills/create-catalog-item/SKILL.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Use this skill when the user asks to create a new CatalogItem, data
66
# Create CatalogItem
77

88
## Goal
9-
To correctly implement a GenUI CatalogItem based on a provided json_schema_builder Schema, including its corresponding data class, top-level function, and Widget class. This ensures the AI model can properly generate and interact with the UI component.
9+
To correctly implement a GenUI CatalogItem based on a provided json_schema_builder Schema, including its corresponding data class, CatalogItem instance, and Widget class. This ensures the AI model can properly generate and interact with the UI component.
1010

1111
## Instructions
1212
When tasked with creating a CatalogItem from a `Schema`, follow these steps:
@@ -19,7 +19,7 @@ When tasked with creating a CatalogItem from a `Schema`, follow these steps:
1919
- Cast each property from the `json` map to its expected type, e.g., `title: json['title'] as String,` or `action: json['action'] as JsonMap?,`.
2020
- Throw an `Exception('Invalid JSON for _<SchemaName>Data')` in the `catch` block if an error occurs.
2121

22-
2. **Create the CatalogItem Top-Level Function**:
22+
2. **Create the CatalogItem Instance**:
2323
- Name it identical to the schema name but without the "Schema" suffix (e.g., `myCard` for `myCardSchema`).
2424
- Declare as a `final CatalogItem`.
2525
- Set `name` to the capitalized version of the name (e.g., `'MyCard'`).
@@ -83,8 +83,7 @@ final basicCard = CatalogItem(
8383
final action = data.action;
8484
if (action == null) return;
8585
final event = action['event'] as JsonMap?;
86-
final name = event?['name'] as String?;
87-
if (name == null || name.isEmpty) return;
86+
final name = (event?['name'] as String?) ?? '';
8887
final JsonMap contextDefinition =
8988
(event?['context'] as JsonMap?) ?? <String, Object?>{};
9089
final JsonMap resolvedContext = await resolveContext(

0 commit comments

Comments
 (0)