readUtf16BeString method
Implementation
String readUtf16BeString(List<int> byteList) {
List<int> utf16BeString = List.generate(
(byteList.length / 2).ceil(),
(index) => 0,
);
for (int i = 0; i < byteList.length; i++) {
if (i % 2 == 0) {
utf16BeString[i ~/ 2] = byteList[i] << 8;
} else {
utf16BeString[i ~/ 2] |= byteList[i];
}
}
return String.fromCharCodes(utf16BeString);
}