decode method
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 result = <dynamic>[];
var currentOffset = offset;
for (final component in components) {
if (component.isDynamic) {
final (off, _) = AbiUint(256).decode(data, currentOffset);
final (value, _) =
component.decode(data, offset + (off as BigInt).toInt());
result.add(value);
currentOffset += 32;
} else {
final (value, consumed) = component.decode(data, currentOffset);
result.add(value);
currentOffset += consumed;
}
}
return (result, currentOffset - offset);
}