The `first` property in Dart returns the first element of the Rune sequence.
The syntax of Runes.first property is:
int first
This first property of Runes returns the first element.
Runes.first returns value of type int
.
In this example,
runes
from the string 'Hello'.first
property.void main() {
Runes runes = Runes('Hello');
int firstRune = runes.first;
print('First rune: $firstRune');
}
First rune: 72
In this example,
emojis
from the string '👋🏽🚀🌟'.first
property.void main() {
Runes emojis = Runes('👋🏽🚀🌟');
int firstEmoji = emojis.first;
print('First emoji: $firstEmoji');
}
First emoji: 128075
In this example,
numbers
from the string '12345'.first
property.void main() {
Runes numbers = Runes('12345');
int firstNumber = numbers.first;
print('First number: $firstNumber');
}
First number: 49
In this Dart tutorial, we learned about first property of Runes: the syntax and few working examples with output and detailed explanation for each example.