normalizeWhitespace method
Collapses consecutive whitespace into single spaces and trims the result.
Example: " Line 1 \n Line 2 " => "Line 1 Line 2"
Implementation
String normalizeWhitespace() => trim().replaceAll(RegExp(r'\s+'), ' ');
Collapses consecutive whitespace into single spaces and trims the result.
Example: " Line 1 \n Line 2 " => "Line 1 Line 2"
String normalizeWhitespace() => trim().replaceAll(RegExp(r'\s+'), ' ');