description

# IndexError constructor

1. @Deprecated("Use IndexError.withLength instead.")

IndexError(

1. int invalidValue,
2. dynamic indexable, [
3. String? name,
4. String? message,
5. int? length,

])

Creates a new IndexError stating that `invalidValue` is not a valid index into `indexable`.

The `length` is the length of `indexable` at the time of the error. If `length` is omitted, it defaults to `indexable.length`.

The message is used as part of the string representation of the error.

## Implementation

    @Deprecated("Use IndexError.withLength instead.")
    IndexError(
      int invalidValue,
      dynamic indexable, [
      String? name,
      String? message,
      int? length,
    ]) : this.indexable = indexable,
         // ignore: avoid_dynamic_calls
         this.length = length ?? indexable.length,
         super.value(invalidValue, name, message ?? "Index out of range");