isNullOrEmpty property
bool
get
isNullOrEmpty
Extension method to check if a String is null or empty.
Returns true
if the string is either null
or an empty string (""
).
Otherwise, returns false
.
Example:
String? text;
print(text.isNullOrEmpty); // Output: true
text = "";
print(text.isNullOrEmpty); // Output: true
text = "Hello";
print(text.isNullOrEmpty); // Output: false
Implementation
bool get isNullOrEmpty => this == null || this!.isEmpty;