removeFirst method

String? removeFirst(
  1. int n
)

Removes the first n characters of the String.

Example

String foo = 'esentis'
String newFoo = foo.removeFirst(3) // 'ntis';

Implementation

String? removeFirst(int n) {
  if (this == null) {
    return null;
  }
  if (this!.isEmpty) {
    return this;
  }
  if (n <= 0) {
    return this;
  }
  if (n >= this!.length) {
    return '';
  }
  return this!.substring(n, this!.length);
}