LoggingInterceptor class

Pretty-print interceptor that logs every request and response.

Add to FlHttpConfig.interceptors:

FlHttpConfig(
  interceptors: [LoggingInterceptor()],
)
Inheritance

Constructors

LoggingInterceptor({FlLogLevel minLevel = FlLogLevel.verbose, void logger(String message)?})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
logger → void Function(String message)?
final
minLevel FlLogLevel
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<T>(RequestContext request, Object error, StackTrace stackTrace) Future<FlResponse<T>?>
Called when an error occurs (network, timeout, etc.) Return a FlResponse to recover from the error, or rethrow/throw to propagate it.
override
onRequest(RequestContext ctx) Future<RequestContext>
Called before each request is sent. Modify and return ctx to alter the outgoing request (headers, body, URI, etc.)
override
onResponse(ResponseContext ctx) Future<ResponseContext>
Called after each successful response. Return a modified ResponseContext to transform the response seen by the caller.
override
toString() String
A string representation of this object.
inherited

Operators

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