getFilterMiddleware<T> function

Middleware<T> getFilterMiddleware<T>(
  1. dynamic condition,
  2. Middleware<T> filterMiddleware
)

Conditionally runs middleware or stops the chain

Example:

getFilterMiddleware(
  (context) => context.authorized,
  middlewareForAuthorized
);

Implementation

Middleware<T> getFilterMiddleware<T>(
  condition,
  Middleware<T> filterMiddleware,
) {
  branchMiddlewareCondition<T>(condition);
  return getBranchMiddleware(condition, filterMiddleware, stopMiddleware);
}