initByValue<T extends ProtobufEnum> method Null safety

Map<int, T> initByValue<T extends ProtobufEnum>(
  1. List<T> byIndex
)

Returns a Map for all of the ProtobufEnums in byIndex, mapping each ProtobufEnum's value to the ProtobufEnum.

Implementation

static Map<int, T> initByValue<T extends ProtobufEnum>(List<T> byIndex) {
  var byValue = <int, T>{};
  for (var v in byIndex) {
    byValue[v.value] = v;
  }
  return byValue;
}