writeEnum<E extends Enum> method
Writes an enum e
index. Increments position by 1.
- It won't allow
enum
s with more than 255 values.
Implementation
int writeEnum<E extends Enum>(E e) {
var index = e.index;
if (index > 255) {
throw StateError("Can't write an enum of index > 255: $index");
}
writeByte(index);
return 1;
}