FunctionalBloomMiddleware class

Function-based middleware implementation wrapping a standalone handler callback.

Allows creating lightweight middleware without defining a new class.

Example

final loggingMiddleware = FunctionalBloomMiddleware((req, next) async {
  print('--> ${req.method} ${req.path}');
  final res = await next();
  print('<-- ${res.statusCode} ${req.path}');
  return res;
});

router.use(loggingMiddleware);
Implemented types

Constructors

FunctionalBloomMiddleware(Future<BloomResponse?> handler(BloomRequest request, BloomNextFunction next))
Creates a FunctionalBloomMiddleware wrapping the given handler callback.

Properties

handler Future<BloomResponse?> Function(BloomRequest request, BloomNextFunction next)
The underlying middleware execution callback function.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

handle(BloomRequest request, BloomNextFunction next) Future<BloomResponse?>
Processes the incoming request and optionally invokes next to continue the middleware pipeline.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited