find<T> method

List<T> find<T>(
  1. String name,
  2. bool required
)

Finds all matching dependencies by their name.

  • name the dependency name to locate.
  • required true to raise an exception when no dependencies are found. Returns a list of found dependencies

Throws a ReferenceException of required is true and no dependencies found.

Implementation

List<T> find<T>(String name, bool required) {
  var locator = locate(name);
  if (locator == null) {
    if (required) throw ReferenceException(null, name);
    return [];
  }

  return _references!.find<T>(locator, required);
}