decode method

  1. @override
(dynamic, int) decode(
  1. Uint8List data,
  2. int offset
)
override

Decodes a value of this type from data at the given offset. Returns the decoded value and the number of bytes consumed.

Implementation

@override
(dynamic, int) decode(Uint8List data, int offset) {
  final lengthType = AbiUint(256);
  final (length, _) = lengthType.decode(data, offset);
  final len = (length as BigInt).toInt();
  final paddedLength = ((len + 31) ~/ 32) * 32;

  return (
    Uint8List.fromList(data.sublist(offset + 32, offset + 32 + len)),
    32 + paddedLength
  );
}