deserializeVariant function
dynamic
deserializeVariant(
- Type self,
- SerialBuffer buffer, {
- SerializerState? state,
- dynamic allowExtensions = true,
Implementation
deserializeVariant(Type self, SerialBuffer buffer, {SerializerState? state, allowExtensions = true}) {
if (state == null) state = SerializerState();
var i = buffer.getVaruint32();
if (i >= self.fields.length) {
throw 'type index $i is not valid for variant';
}
var field = self.fields[i];
return [
field.name,
field.type!.deserialize?.call(field.type, buffer, state: state, allowExtensions: allowExtensions)
];
}