serializeOptional function
void
serializeOptional(
- Type self,
- SerialBuffer buffer,
- Object? data, {
- SerializerState? state,
- bool? allowExtensions = true,
Implementation
void serializeOptional(Type self, SerialBuffer buffer, Object? data, {SerializerState? state, bool? allowExtensions = true}) {
state ??= SerializerState();
if (data == null) {
buffer.push([0]);
} else {
buffer.push([1]);
self.optionalOf!.serialize!(self.optionalOf, buffer, data, state: state, allowExtensions: allowExtensions);
}
}