ProtobufEnum class

A base class for all Protocol Buffer enum types.

All Protocol Buffer enum classes inherit from ProtobufEnum. For example, given the following enum defined in a .proto file:

message MyMessage {
  enum Color {
    RED = 0;
    GREEN = 1;
    BLUE = 2;
  // ...

the generated Dart file will include a MyMessage_Color class that extends ProtobufEnum. It will also include a const MyMessage_Color for each of the three values defined. Here are some examples:

MyMessage_Color.RED  // => a MyMessage_Color instance
MyMessage_Color.GREEN.value  // => 1   // => "GREEN"


ProtobufEnum(int value, String name)
Returns a new constant ProtobufEnum using value and name.


hashCode → int
The hash code for this object. [...]
name → String
This enum's name, as specified in the .proto file.
value → int
This enum's integer value, as specified in the .proto file.
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited


toString() → String
Returns this enum's name.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.


operator ==(Object o) → bool
The equality operator. [...]

Static Methods

initByValue<T extends ProtobufEnum>(List<T> byIndex) → Map<int, T>
Returns a Map for all of the ProtobufEnums in byIndex, mapping each ProtobufEnum's value to the ProtobufEnum.