TocController class

TocController manages the state and coordination between TocWidget and MarkdownWidget.

It provides:

  • Jump functionality: TOC items can scroll to specific headings in the markdown content
  • Bidirectional synchronization: Scroll position changes notify the TOC to update the current item
  • External listener support: External code can listen to index and list changes

Each TocController instance should be used with one TocWidget and one MarkdownWidget.

Constructors

TocController()

Properties

hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Whether the controller has been disposed
no setter
jumpToWidgetIndexCallback TocIndexCallback?
Sets the callback that handles jumping to a specific widget index.
no getter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tocList List<TocItem>
Returns the current list of TOC items.
no setter

Methods

addIndexListener(TocIndexCallback listener) → void
Adds a listener that is called when the current heading index changes.
addTocListListener(TocListCallback listener) → void
Adds a listener that is called when the TOC list is updated.
dispose() → void
Releases all resources and listeners associated with this controller.
findTocItemByWidgetIndex(int widgetIndex) TocItem?
Finds the TOC item for a given widget index.
jumpToWidgetIndex(int widgetIndex) → void
Scrolls the markdown content to the heading at the specified widget index.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyIndexChanged(int widgetIndex) → void
Notifies all listeners that the current heading index has changed.
removeIndexListener(TocIndexCallback listener) → void
Removes a previously added index change listener.
removeTocListListener(TocListCallback listener) → void
Removes a previously added list change listener.
setTocList(List<TocItem> list) → void
Updates the TOC list with new items.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited