BloomMiddleware class abstract
Composable middleware interface for Bloom API routes, full-stack SSR servers, and gateways.
Middleware can inspect or modify incoming BloomRequest instances, short-circuit
execution early (e.g., for authentication failures or CORS preflight), and inspect or
modify outgoing BloomResponse instances after invoking next.
Example
class TimingMiddleware implements BloomMiddleware {
@override
Future<BloomResponse?> handle(BloomRequest request, BloomNextFunction next) async {
final stopwatch = Stopwatch()..start();
final response = await next();
stopwatch.stop();
response.headers['X-Response-Time'] = '${stopwatch.elapsedMilliseconds}ms';
return response;
}
}
router.use(TimingMiddleware());
Constructors
Properties
- 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
requestand optionally invokesnextto continue the middleware pipeline. -
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