parseDependencies<E extends Element> method

DependencyInvocation<E> parseDependencies<E extends Element>(
  1. Element? element
)

Returns parsed dependencies for the provided element.

Throws ArgumentError if not a ClassElement or ExecutableElement.

Implementation

DependencyInvocation<E> parseDependencies<E extends Element>(
  Element? element,
) {
  if (element is ClassElement) {
    return _parseClassDependencies(element) as DependencyInvocation<E>;
  }
  if (element is ExecutableElement) {
    return _parseFunctionDependencies(element) as DependencyInvocation<E>;
  }
  throw BuildError.forElement(
    element!,
    'Only classes or functions are valid as a dependency.',
  );
}