insertItem method
Insert the given item at the given index in the list
Implementation
void insertItem(T item, int index) {
assert(index >= 0 && index <= _items.length);
_items.insert(index, item);
_calcItemPeriod();
// If this is the first item and we're expanding on initial insertion,
// we'll set our status to expanded
if (_expandOnInitialInsertion && _items.length == 1) {
value = ExpandableSliverListStatus.expanded;
}
if (!isCollapsed()) {
_numItemsDisplayed++;
listKey.currentState?.insertItem(
index,
duration: _duration,
);
}
}