Whether an index is within the item count.
bool isValidIndex(int index) => index >= 0 && index < itemCount;