printLongString function

void printLongString(
  1. String text
)

Prints a long string to the console by breaking it into chunks.

This can be useful for debugging or logging very long strings that might otherwise be truncated by the console output limit. Each chunk will be at most 800 characters long.

Implementation

void printLongString(String text) {
  final RegExp pattern = RegExp('.{1,800}'); // 800 is the size of each chunk
  pattern
      .allMatches(text)
      .forEach((RegExpMatch match) => print(match.group(0)));
}