debugBindWidget method

void debugBindWidget()

Marks this controller as bound to a widget. Asserts that no other widget is currently bound. Called by SectionedSliverListState during initState and after a controller swap.

The assert runs before the increment so a failed bind leaves internal state unchanged. In release builds the assert is stripped and the increment proceeds regardless — release-mode misuse will merely over-count, not corrupt the underlying tree.

This is a documented part of the public surface: a SectionedListController may drive at most one mounted SectionedSliverList.controlled widget at a time.

Implementation

void debugBindWidget() {
  assert(
    _bindingCount < 1,
    "SectionedListController is already bound to another "
    "SectionedSliverList. A controller may drive only one widget at "
    "a time.",
  );
  _bindingCount++;
}