firstChildIndexOf method

int? firstChildIndexOf(
  1. int index
)

The index of the first child row of the row at index, which is always index + 1, or null when the row shows no child rows.

null when the row is a file, is collapsed, or has no visible children. Use it for the right arrow key. Throws a RangeError when index is out of range. O(1).

Implementation

int? firstChildIndexOf(int index) {
  final depth = _rows[index]!.depth;
  final next = index + 1;
  // In pre-order, the next row is one level deeper exactly when it is the
  // first child of this row.
  return next < _rows.length && _rows[next]!.depth == depth + 1 ? next : null;
}