addItem method

void addItem(
  1. Categorization c
)

Implementation

void addItem(Categorization c) {
  if (_allItems.contains(c)) return;
  _allItems.add(c);
  if (c is Library) {
    libraries.add(c);
  } else if (c is Mixin) {
    _mixins.add(c);
  } else if (c is Enum) {
    _enums.add(c);
  } else if (c is Class) {
    if (c.isErrorOrException) {
      _exceptions.add(c);
    } else {
      _classes.add(c);
    }
  } else if (c is TopLevelVariable) {
    if (c.isConst) {
      _constants.add(c);
    } else {
      _properties.add(c);
    }
  } else if (c is ModelFunction) {
    _functions.add(c);
  } else if (c is Typedef) {
    _typedefs.add(c);
  } else if (c is Extension) {
    _extensions.add(c);
  } else {
    throw UnimplementedError('Unrecognized element: $c (${c.runtimeType})');
  }
}