Checks if index is within value bounds.
index
bool containsIndex(int index) => length > 0 && index > -1 && index < length;