BearerTokenInterceptor class
Adds a static Authorization header to every outgoing request.
For dynamic tokens, subclass Interceptor and refresh in onRequest.
- Inheritance
-
- Object
- Interceptor
- BearerTokenInterceptor
Constructors
- BearerTokenInterceptor(String tokenProvider())
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tokenProvider → String Function()
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onError(
NetworkException error, ErrorHandler handler) → void -
Called whenever an error occurs (network, timeout, or a rejection from
onRequest / onResponse). You may call
handler.resolveto recover.inherited -
onRequest(
RequestContext context, RequestHandler handler) → void -
Called before the request is sent. Mutate
handler.contextor callhandler.rejectto abort.override -
onResponse(
ResponseContext context, ResponseHandler handler) → void -
Called after a response is received (any status code). You may call
handler.rejectto convert a response into an error.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited