FixtureSources<TRequest> class

An ordered composite of FixtureSources — itself a source.

Sources are consulted in order and the first that resolves wins; that same source then provides the selected document's payload. Use it to layer fixture files over derived fixtures, for example:

final sources = FixtureSources([
  HttpFileFixtureSource(),
  OpenApiFixtureSource(specPath: 'assets/fixtures/openapi.json'),
]);

Documents are routed back to their resolving source by identity, so a source must hand out its own document instances (caching its own collections across resolves is fine); a document instance shared by two sources is rejected loudly rather than silently receiving the wrong payload.

Implemented types

Constructors

FixtureSources(List<FixtureSource<TRequest>> sources)

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sources List<FixtureSource<TRequest>>
The sources, in precedence order.
final

Methods

data(FixtureDocument document) Future<Object?>
Materializes a document's payload: inline data, or a loaded and decoded external file.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(TRequest request) Future<FixtureCollection?>
Returns the collection this source has for request, or null if it has none — the pipeline then consults the next source, if any.
override
toString() String
A string representation of this object.
inherited

Operators

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