google/protobuf.dart

Generate nullable types from WKT wrappers

Closed this issue · 1 comments

Protobuf code generation for C# specifies:

For values that require explicit null, such as using int? in your C# code, Protobuf's "Well Known Types" include wrappers that are compiled to nullable C# types.

syntax = "proto3"

import "google/protobuf/wrappers.proto";

message Person {

    ...
    google.protobuf.Int32Value age = 5;

}

The generated type of the Age property from this example is int? in C#, but Int32Value in Dart.

Is there a way to also generate int? type for Dart?

I'm using Google.Protobuf package to generate C# code and protoc_plugin to generate Dart code.

So, I learned about the added on the wire overhead that wrappers create and decided against using them.