substring method Null safety

String substring(
  1. int startIndex,
  2. [int? endIndex]
)

Returns the substring of this string that extends from startIndex, inclusive, to endIndex, exclusive

Implementation

String substring(int startIndex, [int? endIndex]) {
  return value.substring(startIndex, endIndex);
}