parseUtf8<T extends JsonValue?> static method
Parses the given UTF-8 encoded bytes
into a typed JSON value.
If parsing fails, a FormatException is thrown.
Implementation
static T parseUtf8<T extends JsonValue?>(List<int> bytes) {
final value = _utf8JsonDecoder.convert(bytes);
if (value is T) {
return value;
}
throw FormatException(
'Decoded value is ${JsonValue._typeToString(value.runtimeType)}, '
'expected ${JsonValue._typeToString(T)}',
bytes,
);
}