decode function

dynamic decode(
  1. Uint8List input, [
  2. bool stream = false
])

Implementation

dynamic decode(Uint8List input, [bool stream = false]) {
  if (input.length == 0) return <dynamic>[];

  Uint8List inputBuffer = _toBuffer(input);
  Decoded decoded = _decode(inputBuffer);

  if (stream) return decoded;
  if (decoded.remainder.length != 0) throw FormatException('invalid remainder');

  return decoded.data;
}