ProtobufEnum class
A base class for all proto enum types.
All proto 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)
-
Creates a new constant ProtobufEnum using value and name.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
This enum's name, as specified in the .proto file.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → int
-
This enum's integer value, as specified in the .proto file.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
Returns this enum's name or the value if names are not represented.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
initByValue<
T extends ProtobufEnum> (List< T> byIndex) → Map<int, T> -
Creates a Map for all of the ProtobufEnums in
byIndex
, mapping each ProtobufEnum's value to the ProtobufEnum.