getForkMiddleware<T> function

Middleware<T> getForkMiddleware<T>(
  1. Middleware<T> middleware
)

Runs the middleware at the next event loop and force call next()

Example:

getForkMiddleware((context) {
  statisticsMiddlewares(context);
});

Implementation

// ignore: prefer_expression_function_bodies
Middleware<T> getForkMiddleware<T>(Middleware<T> middleware) {
  return (context, next) async {
    await Future<dynamic>.sync(() => middleware(context, noopNext));

    return next();
  };
}