readEnum<E extends Enum> method
Reads an enum index, and returns a value from enumValues
.
Increments position by 1.
Implementation
E readEnum<E extends Enum>(List<E> enumValues) {
var idx = readByte();
return enumValues[idx];
}