List<EnumField> constants

Source

@override
List<EnumField> get constants {
  if (_enumFields != null) return _enumFields;

  // This is a hack to give 'values' an index of -1 and all other fields
  // their expected indicies. https://github.com/dart-lang/dartdoc/issues/1176
  var index = -1;

  _enumFields = _cls.fields
      .where(isPublic)
      .where((f) => f.isConst)
      .map((field) => new ModelElement.from(field, library, index: index++))
      .toList(growable: false)
        ..sort(byName);

  return _enumFields;
}