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
MyMessage_Color.GREEN.name   // => "GREEN"

Constructors

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

Properties

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

Methods

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

Operators

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.