Hello guys,

I'm generating some enums from proto files to be used in a flutter/dart 
application using the default "protoc-gen-dart" plugin. A Sample proto 
definition looks like this:

syntax = "proto3";
enum TransactionType {
    TransactionTypeNotSet = 0;
    TransactionTypeFirstType = 1;
    TransactionTypeSecondType= 2;
    TransactionTypeThirdType = 3;
}

And the generated code from the plugin looks like this:
class TransactionType extends $pb.ProtobufEnum {
     static const TransactionType TransactionTypeNotSet = TransactionType._(
0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 
'TransactionTypeNotSet');
    static const TransactionType TransactionTypeFirstType = TransactionType
._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 
'TransactionTypeFirstType');
    static const TransactionType TransactionTypeSecondType = TransactionType
._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 
'TransactionTypeSecondType');
    static const TransactionType TransactionTypeThirdType = TransactionType
._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 
'TransactionTypeThirdType');
}

So currently I have to specify the enums like this, "TransactionType.
TransactionTypeFirstType",
which adds some unwanted redundancy, when I could just have it like this, "
TransactionType.FirstType". So what I would like is to have some kind of 
class name prefix removal from the generated enums, which would also be 
useful for other languages which follow a class-based enum approach. Is 
this possible?

Some final remarks: The reason why I just don't specify the enums as 
"FirstType", "SecondType" instead of "TransactionTypeFirstType" in the 
protos is due to the fact that i have some others enum types whose values 
share the same naming (ex: FirstType), which would have re-declaration 
problems. 

Thanks and Regards.
Daniel Fernandes

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/7af5114f-25b7-4e21-a917-83aeb5c66e34n%40googlegroups.com.

Reply via email to