truncate method
Implementation
String truncate({int size = 10}) {
// returns truncated string
// the max returned length of string is 'size'
// if size is 0 or less or size greater than string length, then returns empty string
return (size <= 0) || (size > length) ? '' : '${substring(0, size)}';
}