get<C extends Collection<Model>> static method

C get<C extends Collection<Model>>({
  1. String? id,
  2. Type? modelType,
})

Implementation

static C get<C extends Collection>({String? id, Type? modelType}) {
  if (id != null) {
    return _collections[id];
  }

  if (modelType != null) {
    for (dynamic c in _collections.values) {
      if (c.getModelType() == modelType) {
        return c;
      }
    }
  }

  for (dynamic c in _collections.values) {
    if (c.runtimeType == C) {
      return c;
    }
  }

  dynamic c = BaseCollection();

  return c;
}