dynamicSizeBcsType<T, Input> function
BcsType<T, Input>
dynamicSizeBcsType<T, Input>({
- required String name,
- required T read(),
- required Uint8List serialize(
- Input, {
- BcsWriterOptions? options,
- void validate(
- Input
Implementation
BcsType<T, Input> dynamicSizeBcsType<T, Input>({
required String name,
required T Function(BcsReader) read,
required Uint8List Function(Input, {BcsWriterOptions? options}) serialize,
void Function(Input)? validate,
}) {
final type = BcsType<T, Input>(
name: name,
read: read,
write: (value, writer) {
for (final byte in serialize(value).toList()) {
writer.write8(byte);
}
},
serialize: serialize,
validate: validate,
);
return type;
}