runAppLegacyAsync<T> function
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>(
Type componentType, {
@required Future<void> Function(Injector) beforeComponentCreated,
List<Object> createInjectorFromProviders = const [],
void Function() initReflector,
}) {
assert(T == dynamic || T == componentType, 'Expected $componentType == $T');
if (initReflector != null) {
initReflector();
}
if (isDevMode) {
if (componentType == null) {
throw ArgumentError.notNull('componentType');
}
if (initReflector == null) {
try {
typeToFactory(componentType);
} on StateError catch (_) {
throw ArgumentError(
'Could not bootstrap $componentType: provide "initReflector".',
);
}
}
}
return runAppAsync(
unsafeCast(typeToFactory(componentType)),
beforeComponentCreated: beforeComponentCreated,
createInjector: ([parent]) {
return ReflectiveInjector.resolveAndCreate(
[
SlowComponentLoader,
createInjectorFromProviders,
],
unsafeCast(parent),
);
},
);
}