StatusDocument.parseData constructor

StatusDocument.parseData(
  1. ByteData data
)

Implementation

factory StatusDocument.parseData(ByteData data) {
  Uint8List list =
      data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
  String text = utf8.decode(list);
  Map<String, dynamic> jsonObject;
  try {
    jsonObject = json.decode(text);
    return StatusDocument.parse(jsonObject);
  } on Exception {
    throw Exception(LcpParsingError.errorDescription(LcpParsingErrors.json));
  }
}