Dart Runes isEmpty
Syntax & Examples
Runes.isEmpty property
The `isEmpty` property in Dart checks if there are no elements in the sequence of Unicode code points.
Syntax of Runes.isEmpty
The syntax of Runes.isEmpty property is:
bool isEmpty
This isEmpty property of Runes returns true
if there are no elements in this collection.
Return Type
Runes.isEmpty returns value of type bool
.
✐ Examples
1 Check if sequence is empty
In this example,
- We create an empty sequence of Unicode code points
emptyRunes
. - We use the
isEmpty
property to check if it is empty. - We then print the result to standard output.
Dart Program
void main() {
Runes emptyRunes = Runes('');
bool isEmpty = emptyRunes.isEmpty;
print('Is sequence empty? $isEmpty');
}
Output
Is sequence empty? true
2 Check if non-empty sequence is empty
In this example,
- We create a non-empty sequence of Unicode code points
nonEmptyRunes
from the string 'Hello'. - We use the
isEmpty
property to check if it is empty. - We then print the result to standard output.
Dart Program
void main() {
Runes nonEmptyRunes = Runes('Hello');
bool isNotEmpty = nonEmptyRunes.isEmpty;
print('Is sequence empty? $isNotEmpty');
}
Output
Is sequence empty? false
Summary
In this Dart tutorial, we learned about isEmpty property of Runes: the syntax and few working examples with output and detailed explanation for each example.