decodeRlp function

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

Implementation

dynamic decodeRlp(Uint8List input, [bool stream = false]) {
  if (input == null || 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;
}