How do I get the last n-characters in a string?
I\'ve tried using:
var string = \'Dart is fun\'; var newString = string.substring(-5);
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'