debugAssertChildListIsNonEmptyAndContiguous method Null safety

bool debugAssertChildListIsNonEmptyAndContiguous()

Asserts that the reified child list is not empty and has a contiguous sequence of indices.

Always returns true.

Implementation

bool debugAssertChildListIsNonEmptyAndContiguous() {
  assert(() {
    assert(firstChild != null);
    int index = indexOf(firstChild!);
    RenderBox? child = childAfter(firstChild!);
    while (child != null) {
      index += 1;
      assert(indexOf(child) == index);
      child = childAfter(child);
    }
    return true;
  }());
  return true;
}