attribute method
Adds a XmlAttribute node with the provided name
and value
.
If a namespace
URI is provided, the prefix is looked up, verified
and combined with the given attribute name
.
To generate an element with the tag message and the attribute lang="en" one would write:
builder.element('message', nest: () {
builder.attribute('lang', 'en');
});
Implementation
void attribute(String name, Object value, {String? namespace, XmlAttributeType? attributeType}) {
final attribute = XmlAttributeSyntheticImpl(
_buildName(name, namespace), value.toString(), attributeType ?? XmlAttributeType.DOUBLE_QUOTE);
_stack.last.attributes.add(attribute);
}