lastNChars method

String lastNChars({
  1. int n = 1,
})

this will give last n characters of string

Implementation

String lastNChars({int n = 1}) {
  if (n > length || n < 1) return this;

  return substring(length - n);
}