We can check a string is empty or not by the String Property isEmpty. If the string is empty then it returns True if the string is not empty then it returns False.
Syntax: String.isEmpty
Return : True or False.
Example 1:
Dart
void main() {
String? st = "" ;
print(st.isEmpty);
}
|
Output:
true
Example 2:
Dart
void main() {
String? st = "Geeksforgeeks" ;
print(st.isEmpty);
}
|
Output:
false