ProtobufEnum class Null safety

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, override
name String
This enum's name, as specified in the .proto file.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
value int
This enum's integer value, as specified in the .proto file.
final

Methods

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

Operators

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

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.