extend method
A2uiCatalog
extend({
- required String id,
- Iterable<
A2uiCatalogComponent> components = const [], - Iterable<
A2uiCatalogFunction> functions = const [], - String? instructions,
Returns a copy under a new id with components and functions added,
for extending a base catalog with bespoke components.
An entry named like one of this catalog's replaces it; overriding a
component changes its Express positional signature, so do it
deliberately. Names within each argument must be unique.
instructions, when given, replaces this catalog's (pass '' to clear
them). The base document's title and description are not carried
over.
Implementation
A2uiCatalog extend({
required String id,
Iterable<A2uiCatalogComponent> components = const [],
Iterable<A2uiCatalogFunction> functions = const [],
String? instructions,
}) => A2uiCatalog._(
id: id,
components: {...this.components, ..._byName(components, (c) => c.name)},
functions: {...this.functions, ..._byName(functions, (f) => f.name)},
defs: defs,
instructions: switch (instructions) {
'' => null,
final String custom => custom,
null => _retargetInstructions(
this.instructions,
fromId: this.id,
toId: id,
),
},
extra: {
for (final MapEntry(:key, :value) in _extra.entries)
if (!_documentOnly.contains(key)) key: value,
},
);