parseBUIAttribute function

String? parseBUIAttribute(
  1. String? buiCode,
  2. String attributeName
)

Implementation

String? parseBUIAttribute(String? buiCode, String attributeName) {
  if (buiCode == null) return null;

  var idx1 = buiCode.indexOf('<');
  var idx2 = buiCode.indexOf('>');

  if (idx1 < 0 || idx2 < 0) return null;

  var tag = buiCode.substring(idx1, idx2 + 1);

  var node = $html(tag).first;

  if (node is DOMElement && node.tag == 'bui') {
    var attributeValue = node.getAttributeValue(attributeName);
    return attributeValue;
  }

  return null;
}