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:
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