Dart Runes hashCode
Syntax & Examples
Runes.hashCode property
The `hashCode` property in Dart returns the hash code for the sequence of Unicode code points.
Syntax of Runes.hashCode
The syntax of Runes.hashCode property is:
int hashCode This hashCode property of Runes the hash code for this object.
Return Type
Runes.hashCode returns value of type int.
✐ Examples
1 Get hash code of sequence
In this example,
- We create a sequence of Unicode code points
runesfrom the string 'Hello'. - We use the
hashCodeproperty to get its hash code. - We then print the result to standard output.
Dart Program
void main() {
Runes runes = Runes('Hello');
int hash = runes.hashCode;
print('Hash code: $hash');
}Output
Hash code: 619442723
2 Get hash code of sequence of emojis
In this example,
- We create a sequence of Unicode code points
emojisfrom the string '👋🏽🚀🌟'. - We use the
hashCodeproperty to get its hash code. - We then print the result to standard output.
Dart Program
void main() {
Runes emojis = Runes('👋🏽🚀🌟');
int emojiHash = emojis.hashCode;
print('Emoji hash code: $emojiHash');
}Output
Emoji hash code: 114058667
Summary
In this Dart tutorial, we learned about hashCode property of Runes: the syntax and few working examples with output and detailed explanation for each example.