getAttribute method
Returns the value of the first attribute named attributeName
if it exists, otherwise returns null
.
Implementation
String? getAttribute(String attributeName) {
assert(attributeName.trim().isNotEmpty);
if (attributes == null) return null;
attributeName = attributeName.toLowerCase();
for (var attribute in attributes!) {
if (attribute.name.toLowerCase() == attributeName) {
return attribute.value;
}
}
return null;
}