runAppLegacyAsync<T extends Object> function

Future<ComponentRef<T>> runAppLegacyAsync<T extends Object>(
  1. Type componentType, {
  2. required Future<void> beforeComponentCreated(
    1. Injector
    ),
  3. List<Object> createInjectorFromProviders = const [],
  4. void initReflector()?,
})

Starts a new AngularDart application with componentType as the root.

This is the runAppLegacy variant of the runAppAsync function.

Implementation

Future<ComponentRef<T>> runAppLegacyAsync<T extends Object>(
  Type componentType, {
  required Future<void> Function(Injector) beforeComponentCreated,
  List<Object> createInjectorFromProviders = const [],
  void Function()? initReflector,
}) {
  assert(T == Object || T == componentType, 'Expected $componentType == $T');
  if (initReflector != null) {
    initReflector();
  }
  return runAppAsync(
    unsafeCast(typeToFactory(componentType)),
    beforeComponentCreated: beforeComponentCreated,
    createInjector: (parent) {
      return ReflectiveInjector.resolveAndCreate(
        [
          createInjectorFromProviders,
        ],
        unsafeCast(parent),
      );
    },
  );
}