fitGridLaidOutRowCount function

int fitGridLaidOutRowCount({
  1. int index = 0,
})

Number of rows currently laid out.

Assert on this to prove virtualization is working: it should track the viewport, not the dataset. A grid of 100,000 rows in a 600px viewport should report tens, not tens of thousands.

Implementation

int fitGridLaidOutRowCount({int index = 0}) {
  final section = fitGridSection(index: index);
  return (section.firstVisibleRow + section.visibleRowCount).clamp(
        0,
        section.rowCount,
      ) -
      section.firstVisibleRow;
}