wrap function
List<String>
wrap(
- String text, {
- int width = 70,
- String initialIndent = '',
- String subsequentIndent = '',
- bool expandTabs = true,
- bool replaceWhitespace = true,
- bool fixSentenceEndings = false,
- bool breakLongWords = true,
- bool dropWhitespace = true,
- bool breakOnHyphens = true,
- int tabSize = 8,
- int maxLines = -1,
- String placeholder = '...',
Wrap a single paragraph of text.
Implementation
List<String> wrap(
String text, {
int width = 70,
String initialIndent = '',
String subsequentIndent = '',
bool expandTabs = true,
bool replaceWhitespace = true,
bool fixSentenceEndings = false,
bool breakLongWords = true,
bool dropWhitespace = true,
bool breakOnHyphens = true,
int tabSize = 8,
int maxLines = -1,
String placeholder = '...',
}) {
var chunks = splitChunks(text,
breakOnHyphens: breakLongWords,
expandTabs: expandTabs,
tabSize: tabSize,
replaceWhitespace: replaceWhitespace);
if (fixSentenceEndings) {
fixEndings(chunks);
}
return wrapChunks(chunks,
width: width,
initialIndent: initialIndent,
subsequentIndent: subsequentIndent,
breakLongWords: breakLongWords,
dropWhitespace: dropWhitespace,
breakOnHyphens: breakOnHyphens,
maxLines: maxLines,
placeholder: placeholder);
}