call method
Call operator for children
Implementation
Morphic call([List<dynamic>? children]) {
// 🔑 Void elements no pueden tener children
if (isVoid && children != null && children.isNotEmpty) {
throw ArgumentError(
'<$tag> is a void element and cannot have children. '
'Use $tag() without arguments or $tag.attr() methods only.',
);
}
final normalizedChildren = isVoid
? <Object>[]
: _normalizeChildren(children ?? []);
final finalAttrs = <String, Attribute>{
if (_classes != null) 'class': ClassAttribute(_classes!),
if (_id != null) 'id': StringAttribute(_id!),
if (_style != null) 'style': StyleAttribute(_style!),
..._attrs,
};
return ElementMorphic(
tag: tag,
key: key,
attributes: finalAttrs,
children: normalizedChildren,
);
}