setTocList method

void setTocList(
  1. List<TocItem> list
)

Updates the TOC list with new items.

This method is called when the markdown content is parsed and headings are extracted. It replaces the existing TOC items.

Implementation

void setTocList(List<TocItem> list) {
  if (_isDisposed) return;

  _widgetIndex2TocItem.clear();
  for (final item in list) {
    _widgetIndex2TocItem[item.widgetIndex] = item;
  }
  _notifyListChanged(List.unmodifiable(list));
}