fill function

String fill(
  1. String text, {
  2. int width = 70,
  3. String initialIndent = '',
  4. String subsequentIndent = '',
  5. bool expandTabs = true,
  6. bool replaceWhitespace = true,
  7. bool fixSentenceEndings = false,
  8. bool breakLongWords = true,
  9. bool dropWhitespace = true,
  10. bool breakOnHyphens = true,
  11. int tabSize = 8,
  12. int maxLines = -1,
  13. String placeholder = '...',
})

Fill a single paragraph of text.

Implementation

String fill(
  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 = '...',
}) {
  return wrap(text,
          width: width,
          initialIndent: initialIndent,
          subsequentIndent: subsequentIndent,
          expandTabs: expandTabs,
          replaceWhitespace: replaceWhitespace,
          fixSentenceEndings: fixSentenceEndings,
          breakLongWords: breakLongWords,
          dropWhitespace: dropWhitespace,
          breakOnHyphens: breakOnHyphens,
          tabSize: tabSize,
          maxLines: maxLines,
          placeholder: placeholder)
      .join('\n');
}