shorten method
shorten a string to a given length split the string in half and add ... in the middle e.g. "1234567890" -> "123...890"
Implementation
String? shorten(int length) {
if (this == null) return null;
if (this!.isEmpty) return this;
if (this!.length <= length) return this;
var half = length ~/ 2;
return this!.substring(0, half) +
'...' +
this!.substring(this!.length - half);
}