Skip to content
New issue

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

[Bug][proto3] inconsistent behavior of assigning null value for optional string #794

Closed
thanhdatvo opened this issue Jan 26, 2023 · 1 comment

Comments

@thanhdatvo
Copy link

thanhdatvo commented Jan 26, 2023

syntax = "proto3";

package test;

message SomeMessage { optional string optional_string = 1; }

When I use this message in dart code like this:

final someMessage = SomeMessage(optionalString: null);
someMessage.optionalString = null; // error

It throwed an error:
"
A value of type 'Null' can't be assigned to a variable of type 'String'.
Try changing the type of the variable, or casting the right-hand type to 'String'
"
I think it should be consistent between initialization and reassign value for message attributes.

@thanhdatvo thanhdatvo changed the title [Bug][proto3] assign null value for optional string [Bug][proto3] inconsistent behavior of assign null value for optional string Jan 26, 2023
@thanhdatvo thanhdatvo changed the title [Bug][proto3] inconsistent behavior of assign null value for optional string [Bug][proto3] inconsistent behavior of assigning null value for optional string Jan 26, 2023
@osa1
Copy link
Member

osa1 commented Jan 31, 2023

Duplicate of #523, #493, and many others. #790 is fixing this.

@osa1 osa1 closed this as completed Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants