Google is committed to advancing racial equity for Black communities. See how.

decode method

  • @override

String decode (Decoder decoder, int offset) override

Implementation

@override
String decode(Decoder decoder, int offset) {
  final int size = decoder.decodeUint64(offset);
  final int data = decoder.decodeUint64(offset + 8);
  validateEncoded(size, data);
  if (data == kAllocAbsent) {
    return null;
  }
  final Uint8List bytes =
      decoder.data.buffer.asUint8List(decoder.claimMemory(size), size);
  try {
    return const Utf8Decoder().convert(bytes, 0, size);
  } on FormatException {
    throw FidlError('Received a string with invalid UTF8: $bytes');
  }
}