Skip to content
Related Articles

Related Articles

How to Check String is Empty or not in Dart?
  • Last Updated : 14 Jul, 2020
GeeksforGeeks - Summer Carnival Banner

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






// main function start
void main() { 
    
    // initialise a string st
    String st = "";
    
    // print string is empty or not
    print(st.isEmpty); 
}

Output:

true

Example 2:
 

Dart




// main function start
void main() {
    
    // initialise a string st
    String st = "Geeksforgeeks";
    
    // print string is empty or not
    print(st.isEmpty); 
}

Output: 

false

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :