setAttribute method

  1. @mustCallSuper
void setAttribute(
  1. String qualifiedName,
  2. String value
)

Implementation

@mustCallSuper
void setAttribute(String qualifiedName, String value) {
  ElementAttributeProperty? propertyHandler =
      _attributeProperties[qualifiedName];
  final bool invokedByPropertyHandler =
      propertyHandler != null && propertyHandler.setter != null;
  if (invokedByPropertyHandler) {
    // Let the property handler perform the actual mutation (e.g., className setter)
    propertyHandler!.setter!(value);
  }
  // Persist attribute map + emit DevTools events exactly once and avoid
  // redundant style work when the property handler already did it.
  internalSetAttribute(qualifiedName, value,
      invokedByAttributeSetter: invokedByPropertyHandler);
}