runLoader method

FutureOr<Object?> runLoader({
  1. required AppContext app,
  2. required RouteNavigator router,
  3. required RouteMatches matches,
})

Runs this shell's loader for the active branch.

Implementation

FutureOr<Object?> runLoader({
  required AppContext app,
  required RouteNavigator router,
  required RouteMatches matches,
}) {
  final loader = load;
  if (loader == null) return const NoData();
  final match = matches.match(this);
  if (match == null) {
    throw StateError('Shell route is not part of the active route branch.');
  }
  return loader(
    PageLoadContext<P, S>(
      app: app,
      router: router,
      params: match.params,
      search: match.search,
      location: matches.location,
      matches: matches,
    ),
  );
}