resolve method

Future<ReflectableOutput> resolve(
  1. LibraryElement library
)

Returns information needed to write .template.dart files.

Implementation

Future<ReflectableOutput> resolve(LibraryElement library) async {
  final registerClasses = <ReflectableClass>[];
  final registerFunctions = <DependencyInvocation<ExecutableElement>>[];
  for (final unit in _allUnits(library)) {
    for (final type in unit.types) {
      final reflectable = _resolveClass(type);
      if (reflectable != null) {
        registerClasses.add(reflectable);
      }
      if (recordInjectableFactories) {
        registerFunctions.addAll(_resolveFunctions(type.methods));
      }
    }
    if (recordInjectableFactories) {
      registerFunctions.addAll(_resolveFunctions(unit.functions));
    }
  }
  var urlsNeedingInitReflector = const <String>[];

  // Only link to other ".initReflector" calls if either flag is enabled.
  if (recordInjectableFactories || recordComponentFactories) {
    urlsNeedingInitReflector = await _resolveNeedsReflector(library);
  }

  return ReflectableOutput(
    urlsNeedingInitReflector: urlsNeedingInitReflector,
    registerClasses: registerClasses,
    registerFunctions: registerFunctions,
  );
}