parseAttributeBool function

bool? parseAttributeBool(
  1. Map<String, DOMAttribute> attributes,
  2. String name, [
  3. bool? defaultValue
])

The boolean attribute name of a component tag, read as HTML does (DOMAttribute.parseBooleanValue), or defaultValue if absent:

// <ui-dialog show>, show="", show="show", show="true"  -> true
// <ui-dialog show="false">                             -> false
// <ui-dialog>                                          -> defaultValue

Implementation

bool? parseAttributeBool(
  Map<String, DOMAttribute> attributes,
  String name, [
  bool? defaultValue,
]) {
  var attribute = attributes[name];
  if (attribute == null) return defaultValue;
  return DOMAttribute.parseBooleanValue(name, attribute.value);
}