wrapString function
Shortens a string to wrapTo
characters and appends an ellipsis
if the string was longer than wrapTo
characters
Implementation
String wrapString(String target, [int wrapTo = 50]) {
final isShortEnough = target.length <= wrapTo;
return "'${isShortEnough ? target : target.substring(0, min(target.length, wrapTo))}'";
}