isValidArrayIndex method

bool isValidArrayIndex(
  1. int length
)

Checks if value is definitely within bounds [0, length).

Implementation

bool isValidArrayIndex(int length) {
  if (isBottom) return true; // vacuously true
  if (min == null || min! < 0) return false;
  if (max == null || max! >= length) return false;
  return true;
}