remove method
Remove the child at the specified index from the child list.
Implementation
@override
void remove(int index) {
final RenderBox? child = this[index];
// if child is null, it means this element was cached - drop the cached element
if (child == null) {
final RenderBox? cachedChild = _keepAliveBucket[index];
if (cachedChild != null) {
dropChild(cachedChild);
_keepAliveBucket.remove(index);
}
return;
}
final childParentData =
child.parentData! as SliverVariableSizeBoxAdaptorParentData;
if (!childParentData._keptAlive) {
super.remove(index);
return;
}
assert(_keepAliveBucket[childParentData.index!] == child);
_keepAliveBucket.remove(childParentData.index);
dropChild(child);
}