IndexError.withLength constructor

  1. @Since("2.19")
IndexError.withLength(
  1. int invalidValue,
  2. int length, {
  3. Object? indexable,
  4. String? name,
  5. String? message,
})

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.

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

Implementation

@Since("2.19")
IndexError.withLength(
  int invalidValue,
  this.length, {
  this.indexable,
  String? name,
  String? message,
}) : super.value(invalidValue, name, message ?? "Index out of range");