StubOfflineFirstWithRest class
Generate mocks for an OfflineFirstWithRestModel. Instantiation automatically stubs REST responses.
For convenience, your data structure only needs to be defined once. Include a sample API
response in a sibling /api/
directory (api
can be changed by overwriting apiResponse
).
For example,
// /test/api/user.json
{
'user': {
'name' : 'Thomas'
}
}
Constructors
-
StubOfflineFirstWithRest({required String baseEndpoint, required Iterable<
StubOfflineFirstRestResponse> responses}) -
StubOfflineFirstWithRest.fromFiles(String baseEndpoint, Map<
String, String> endpointsAndFilePaths) -
Provide a list of responses from a list of endpoints, for example:
factory
Properties
- baseEndpoint → String
-
The prefix for all endpoints. For example,
http://0.0.0.0:3000/api
inhttp://0.0.0.0:3000/api
. This is equivalent toRestProvider#baseEndpoint
.final - client → MockClient
-
Create a client to use with RestProvider that responds to endpoints
with predefined responses.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
responses
→ Iterable<
StubOfflineFirstRestResponse> -
All reponses to return from an endpoint. For example,
user/1
orusers?limit=20&offset=1
. Automatically prefixed with$baseEndpoint/
.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
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited