removeWhiteSpace property

String? removeWhiteSpace

Removes all whitespace from the String.

Example

String foo = '   Hel l o W   orld';
String striped = foo.removeWhiteSpace; // returns 'HelloWorld';

Implementation

String? get removeWhiteSpace {
  if (this.isBlank) {
    return this;
  }
  return this!.replaceAll(RegExp(r'\s+'), '');
}