splitLine method

List<String> splitLine(
  1. int maxLength
)

Split this String, that is a single long line (maybe without any linebreaks) into multiple Strings with a maximum length of maxLength. Linebreaks are assumes to be \n.

The lines are split where a whitespace is. The length of a line may be more than maxLength, if the long line has no whitespaces that allow it to be split into multiple lines.

Implementation

List<String> splitLine(int maxLength) {
  return split("\n")
      .map((e) => e._splitLineImpl(maxLength))
      .expand((element) => element)
      .toList();
}