strLimit method
Implementation
String strLimit(int limit, [String ending = '...']) {
if (length > limit) {
return substring(0, limit) + ending;
}
return this;
// example:
// strLimit('Hello World', 5); // returns 'Hello...'
// strLimit('Hello World', 5, '!'); // returns 'Hello!'
}