Interceptor class

Interceptor middleware for Spry.

Interceptor middleware is used to intercept program exceptions and errors to prevent the program from crashing.

Example:

final Spry spry = Spry();

spry.use(Interceptor());

handler(Context context) {
  throw Exception('This is an exception');
}

await spry.listen(handler, port: 3000);

Constructors

Interceptor({ExceptionHandler? handler})
Create a Interceptor middleware.
factory

Properties

handler ExceptionHandler
The exception handler.
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

call(Context context, Next next) FutureOr<void>
The interceptor middleware-style function.
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