removeAllWhiteSpaces method

String removeAllWhiteSpaces()

Removes all whitespace characters (spaces, tabs, newlines) from the string.

@returns A new string with all whitespace removed.

Example:

final long = 'one two\nthree';
print(long.removeAllWhiteSpaces()); // "onetwothree"

Implementation

String removeAllWhiteSpaces() => replaceAll(RegExp(r'\s+'), '');