encode method
ABI-encode value as a 32-byte-aligned Uint8List.
For dynamic types, returns the tail; the caller places the offset in the head.
Implementation
@override
Uint8List encode(dynamic value) {
if (value is! String) {
throw ArgumentError('Expected String, got ${value.runtimeType}');
}
final bytes = Uint8List.fromList(utf8.encode(value));
final paddedLen = _padTo32(bytes.length);
final out = Uint8List(32 + paddedLen);
_writeUint256(out, 0, BigInt.from(bytes.length));
out.setRange(32, 32 + bytes.length, bytes);
return out;
}