wrap method
Wraps a long text so that every line is at most width
characters long.
Implementation
String wrap(
int width, {
Pattern? whitespace,
bool breakLongWords = true,
}) {
checkNonZeroPositive(width, 'width');
return split('\n')
.map((line) =>
line._wrap(width, whitespace ?? defaultWhitespace, breakLongWords))
.join('\n');
}