slice function

String slice(
  1. int start,
  2. int end,
  3. String s
)

Returns a substring.

print(slice(0, 2, 'hello')); // Outputs: 'he'

Implementation

String slice(int start, int end, String s) => s.substring(start, end);