ConditionalInterceptor class

A conditional interceptor that only executes when a condition is met

This is useful for creating interceptors that should only run under certain conditions (e.g., only for specific URLs or methods).

Example:

final conditionalInterceptor = ConditionalInterceptor(
  condition: (request) => request.url.contains('api.example.com'),
  interceptor: LoggingInterceptor(),
);
Inheritance

Constructors

ConditionalInterceptor.new({required bool condition(FittorRequest), required FittorInterceptor interceptor})
Creates a conditional interceptor

Properties

condition bool Function(FittorRequest)
final
hashCode int
The hash code for this object.
no setterinherited
interceptor FittorInterceptor
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(dynamic error, StackTrace stackTrace) Future
Called when an error occurs during request processing
override
onRequest(FittorRequest request) Future<FittorRequest>
Called before a request is sent
override
onResponse(FittorResponse response) Future<FittorResponse>
Called after a successful response is received
override
toString() String
A string representation of this object.
inherited

Operators

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