disconnectedCallback method

  1. @override
void disconnectedCallback()
override

Implementation

@override
void disconnectedCallback() {
  super.disconnectedCallback();
  _updateIDMap(null, oldID: _id);
  _updateNameMap(null, oldName: getAttribute(_nameAttr));
  // Remove from class index
  if (_classList.isNotEmpty) {
    _updateClassIndex(List.from(_classList), const <String>[]);
  }
  // Remove all attribute presence indices
  if (attributes.isNotEmpty) {
    for (final name in attributes.keys) {
      _updateAttrPresenceIndex(name, present: false);
    }
  }
  if (renderStyle.position == CSSPositionType.fixed ||
      renderStyle.position == CSSPositionType.absolute ||
      renderStyle.position == CSSPositionType.sticky) {
    holderAttachedContainingBlockElement
        ?.removeOutOfFlowPositionedElement(this);
    holderAttachedContainingBlockElement?.renderStyle
        .requestWidgetToRebuild(UpdateChildNodeUpdateReason());
  }
  _connectedCompleter = null;

  // Notify controller that this element was removed (for LCP tracking)
  ownerDocument.controller.notifyElementRemoved(this);
}