We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data of type "string?" cannot be serialized when it is null.
void serializeStruct(Type self, SerialBuffer buffer, Object data, {SerializerState state, allowExtensions = true}) { if (state == null) state = SerializerState(); // try { if (self.base != null) { self.base.serialize(self.base, buffer, data, state: state, allowExtensions: allowExtensions); } var dy = data as dynamic; for (var field in self.fields) { if (dy[field.name] != null) { if (state.skippedBinaryExtension) { throw 'unexpected ' + self.name + '.' + field.name; } field.type.serialize(field.type, buffer, dy[field.name], state: state, allowExtensions: allowExtensions && field == self.fields[self.fields.length - 1]); } else { if (allowExtensions && field.type.extensionOf != null) { state.skippedBinaryExtension = true; } else if(field.type.optionalOf != null ) { field.type.serialize(field.type, buffer, dy[field.name],state: state); } else { throw 'missing ' + self.name + '.' + field.name + ' (type=' + field.type.name + ')'; } } }
to:
void serializeStruct(Type self, SerialBuffer buffer, Object data, {SerializerState state, allowExtensions = true}) { if (state == null) state = SerializerState(); // try { if (self.base != null) { self.base.serialize(self.base, buffer, data, state: state, allowExtensions: allowExtensions); } var dy = data as dynamic; for (var field in self.fields) { if (dy[field.name] != null) { if (state.skippedBinaryExtension) { throw 'unexpected ' + self.name + '.' + field.name; } field.type.serialize(field.type, buffer, dy[field.name], state: state, allowExtensions: allowExtensions && field == self.fields[self.fields.length - 1]); } else { if (allowExtensions && field.type.extensionOf != null) { state.skippedBinaryExtension = true; } else { throw 'missing ' + self.name + '.' + field.name + ' (type=' + field.type.name + ')'; } } }
The text was updated successfully, but these errors were encountered:
PR is welcomed!
Sorry, something went wrong.
fix optionalOf serialize bug primes-network#31
fbdedf1
No branches or pull requests
Data of type "string?" cannot be serialized when it is null.
to:
The text was updated successfully, but these errors were encountered: