How to get the last n-characters in a string in Dart?
Create an extension:
extension E on String {
String lastChars(int n) => substring(length - n);
}
Usage:
var source = 'Hello World';
var output = source.lastChars(5); // 'World'
var newString = string.substring(string.length - 5);