by @kodeazy
flutter How to convert string to its ASCII value?
In this blog we will discuss on how to convert String
to its ASCII
value
To convert String
to its ASCII
value we use AsciiEncoder
class convert
method by importing import 'dart:convert'
.
Below is the syntax
AsciiEncoder().convert(example);
Below is the example code of converting String
to its ASCII
value.
import 'dart:convert';
void main() {
String example = 'flutter Example';
const asciiEncoder = AsciiEncoder();
print(AsciiEncoder().convert(example));
}
Output:
[102, 108, 117, 116, 116, 101, 114, 32, 69, 120, 97, 109, 112, 108, 101]