FixturesInterceptor class
Dio interceptor that serves fixture responses through a FixturePipeline.
Every request is normalized into an HttpFixtureRequest and served by
the pipeline — sources, selection strategy, picker, memory and delay all
live there. This interceptor only renders the outcome in Dio's terms: a
FixtureServed becomes a Response whose status comes from the
document's description, and a FixtureMiss rejects with a
DioException whose error is the miss itself, so callers can branch
on FixtureNotFound, FixtureEmpty, or FixtureCancelled.
final pipeline = FixturePipeline(
source: HttpFileFixtureSource(),
selector: DataSelectorType.pick,
view: FixturesDialogView.of(context),
);
dio.interceptors.add(FixturesInterceptor(pipeline: pipeline));
Build the pipeline once, next to the Dio instance: remembered choices
live in it. Served responses are stamped with documentHeader (and
filePathHeader when the payload is an external file); read them
through ResponseOrigin.of.
Constructors
-
FixturesInterceptor({required FixturePipeline<
HttpFixtureRequest> pipeline})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
pipeline
→ FixturePipeline<
HttpFixtureRequest> -
The pipeline every request is served through.
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(
DioException err, ErrorInterceptorHandler handler) → void -
Called when an exception was occurred during the request.
inherited
-
onRequest(
RequestOptions options, RequestInterceptorHandler handler) → void - Called when the request is about to be sent.
-
onResponse(
Response response, ResponseInterceptorHandler handler) → void -
Called when the response is about to be resolved.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- documentHeader → const String
-
Set on every fixture-served response, with the served document's
identifier as value. Read it through
ResponseOrigin.of. - filePathHeader → const String
- Set on fixture-served responses whose document has an external payload file, with that file's path as value.