isNullOrWhiteSpace property

bool isNullOrWhiteSpace

Checks if the string is either null, empty, or contains only whitespace characters. This is useful for validating input fields where a meaningful string is required.

Example:

print('   '.isNullOrWhiteSpace); // Output: true
print('word'.isNullOrWhiteSpace); // Output: false

Implementation

bool get isNullOrWhiteSpace => trim().isEmpty;