calculateTrailingGarbage method
- required int lastIndex,
Returns the number of children following the lastIndex
that need to be
garbage collected.
See also:
- collectGarbage, which takes the leading and trailing number of children to be garbage collected.
- calculateLeadingGarbage, which similarly returns the number of leading children to be garbage collected.
Implementation
@visibleForTesting
@protected
int calculateTrailingGarbage({required int lastIndex}) {
RenderBox? walker = lastChild;
int trailingGarbage = 0;
while (walker != null && indexOf(walker) > lastIndex) {
trailingGarbage += 1;
walker = childBefore(walker);
}
return trailingGarbage;
}