getAttribute method

String? getAttribute(
  1. String name, {
  2. String? namespaceUri,
})

Returns the attribute value with the given name, or null.

Both name and namespaceUri can be a specific String; or '*' to match anything. If no namespaceUri is provided, the fully qualified name is compared; otherwise only the local name is considered.

Implementation

String? getAttribute(String name, {String? namespaceUri}) =>
    getAttributeNode(name, namespaceUri: namespaceUri)?.value;