substring method

StringView substring(
  1. int start, [
  2. int? end
])

Returns a new StringView spanning a portion of this view.

The new view references the exact same parent string directly.

Implementation

StringView substring(int start, [int? end]) {
  final localEnd = end ?? length;
  if (start < 0 || localEnd > length || start > localEnd) {
    throw RangeError('Invalid substring bounds for StringView');
  }
  return StringView.substring(_string, _start + start, _start + localEnd);
}