hasWhitespace property
Checks whether the String
has any whitespace characters.
Example
String foo = 'Hello World';
bool hasWhitespace = foo.hasWhitespace; // returns true;
String foo = 'HelloWorld';
bool hasWhitespace = foo.hasWhitespace; // returns false;
Implementation
bool get hasWhitespace {
if (isBlank) {
return false;
}
return contains(RegExp(r'\s'));
}