resolveAndCreate method

ReflectiveInjector resolveAndCreate(
  1. List<Object> providersOrLists,
  2. [Injector parent = const EmptyInjector()]
)

Creates a new Injector that resolves Provider instances at runtime.

This is an expensive operation without any sort of caching or optimizations that manually walks the nested providersOrLists, and uses a form of runtime reflection to figure out how to map the providers to runnable code.

Using this function can disable all tree-shaking for any @Injectable annotated function or class in your entire transitive application, and is provided for legacy compatibility only.

Implementation

static ReflectiveInjector resolveAndCreate(
  List<Object> providersOrLists, [
  Injector parent = const EmptyInjector(),
]) {
  // Return the default implementation.
  final flatProviders = _flattenProviders(providersOrLists);
  if (isDevMode) {
    _assertProviders(flatProviders.providers.values);
    _assertProviders(flatProviders.multiProviders);
  }
  return _RuntimeInjector(
    flatProviders.providers,
    flatProviders.multiProviders,
    unsafeCast(parent),
    false,
  );
}