decodeUtf8Text function
Decodes bytes as strict UTF-8 text, or returns null for binary content
(omp's decodeUtf8Text: NUL bytes or malformed UTF-8 mark binary).
Implementation
String? decodeUtf8Text(Uint8List bytes) {
if (bytes.contains(0)) return null;
try {
return utf8.decode(bytes);
} on Object {
return null;
}
}