Dart Runes last
Syntax & Examples
Runes.last property
The `last` property in Dart returns the last element of a sequence of Unicode code points.
Syntax of Runes.last
The syntax of Runes.last property is:
int last
This last property of Runes returns the last element.
Return Type
Runes.last returns value of type int
.
✐ Examples
1 Get the last element of a sequence
In this example,
- We create a sequence of Unicode code points
runes
from the string 'Hello'. - We access the last element using the
last
property. - We then print the result to standard output.
Dart Program
void main() {
Runes runes = Runes('Hello');
int lastElement = runes.last;
print('Last element of runes: $lastElement');
}
Output
Last element of runes: 111
2 Get the last emoji from a sequence
In this example,
- We create a sequence of Unicode code points
emojis
from the string '👋🏽🚀🌟'. - We access the last element using the
last
property. - We then print the result to standard output.
Dart Program
void main() {
Runes emojis = Runes('👋🏽🚀🌟');
int lastEmoji = emojis.last;
print('Last emoji: $lastEmoji');
}
Output
Last emoji: 127775
Summary
In this Dart tutorial, we learned about last property of Runes: the syntax and few working examples with output and detailed explanation for each example.