propagateGuards function

List<IRoute> propagateGuards({
  1. required List<IGuard> guards,
  2. required List<IRoute> routes,
})

Injects a list of guards into each route module in the given list.

Iterates through the routes list and applies _injectGuards to inject the provided guards into each route.

routes: The list of route modules to inject guards into. parentGuards: The list of guards to inject into each route.

Returns a new list of route modules with guards injected.

Implementation

List<IRoute> propagateGuards({
  required List<IGuard> guards,
  required List<IRoute> routes,
}) => routes.map((route) => _injectGuards(route, guards)).toList();