Add Your Heading Text Here

Dart Runes are the UTF-32 unicode points of a string.

Unicode values are nothing but Standard for representing characters as integers.

Unicode defines a unique number value for each letter, digit and used in all of the world’s popular languages(Writing Systems);

For ex :

0 to 9, Capital letters(A,B,…,Y,Z) etc. have unique Unicode values to identify easily by the Machine.

Rune is nothing but an integer representing unicode codepoint.

For ex :

Character A has Rune value \u{0041} and Unicode is U+0041.

For More Details you should visit and check details at website.

Different emojis, letters and also digits have unique unicode codepoints. which implies they also have unique Rune Values(code points).

we can express a Unicode code point as \uXXXX, where XXXX is a 4-digit hexidecimal value. and u stands for unicode.

For ex :

the heart character (?) is \u2665.

To specify more or less than 4 hex digits in Runes, place the value in curly brackets.

For ex :

the thumbsup emoji (??) is \u{1f44d}.

For ex :

void main()
 {

        Runes clapping = new Runes("\u{0050}");
        print(clapping);
        print(new String.fromCharCodes(clapping));

        Runes input = new Runes('\u2665  \u{1f605}  \u{1f60e}  \u{1f47b}  \u{1f596}  \u{1f44d}');
        print(new String.fromCharCodes(input));
}

Output :

(80)
P
? ?? ?? ?? ?? ??

In dart, string class has several properties and methods to extract the rune information.

Runes Common Properties

For ex :

main() {
  Runes clapping = new Runes("\u{0050}");
  Runes clappingData = new Runes("ABCD");
  print(clappingData.first);
  print(clappingData.last);

  print(clapping.single);
  print(clapping.hashCode);
  print(clapping.runtimeType);
  print(clapping.isEmpty);
  print(clapping.isNotEmpty);
  print(clapping.length);
}

Output :

65
68
80
31123396
Runes
false
true
1

Runes Common Methods

For ex :

main() {
  Runes clappingData = new Runes("ABCD");
  print(clappingData.toString());
  print(clappingData.skip(1));
  print(clappingData.contains("C"));
  print(clappingData.contains((67)));
  print(clappingData.toList());
  print(clappingData.toSet());
}

Output :

(65, 66, 67, 68)
(66, 67, 68)
false
true
[65, 66, 67, 68]
{65, 66, 67, 68}

Practice different properties and methods of dart runes by yourself to understand the better use of it.

Feel free to ask your questions in the comment section. Keep reading and commenting your suggestions to make toastguyz a better site to learn different programming languages.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Show Buttons
Hide Buttons