substring method

  1. @override
String substring(
  1. int start, [
  2. int? end
])
override

The substring of this string from start, inclusive, to end, exclusive.

Example:

const string = 'dartlang';
var result = string.substring(1); // 'artlang'
result = string.substring(1, 4); // 'art'

Both start and end must be non-negative and no greater than length; end, if provided, must be greater than or equal to start.

Implementation

@override
String substring(int start, [int? end]) => _str.substring(start, end);