I am reading a binary file and want to transform it into a String. How do I do it in Dart?
Asked
Active
Viewed 6,080 times
1 Answers
5
Try the following
String getStringFromBytes(ByteData data) {
final buffer = data.buffer;
var list = buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
return utf8.decode(list);
}
Also see this answer.

Oswin Noetzelmann
- 9,166
- 1
- 33
- 46