MockAPIProvider class

Records API calls and returns YAML-configured mock responses by API name.

Inheritance
  • Object
  • APIProvider
  • HTTPAPIProvider
  • MockAPIProvider

Constructors

MockAPIProvider({required Map<String, MockAPIResponse> mocks, HTTPAPIProvider? delegate})

Properties

calls List<APICallRecord>
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
simulateNetworkOffline bool
When true, invokeApi returns an offline error without calling the delegate.
getter/setter pair

Methods

callCount(String apiName) int
callsFor(String apiName) List<APICallRecord>
clearApiExceptions() → void
clearMocks() → void
clone() MockAPIProvider
Same instance as config — keeps call recording aligned with EnsembleTestContext.
override
dispose() → void
override
init(String appId, Map<String, dynamic> config) Future<void>
override
invokeApi(BuildContext context, YamlMap api, DataContext eContext, String apiName) Future<HttpResponse>
override
invokeMockAPI(DataContext eContext, dynamic mock) Future<HttpResponse>
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetCalls() → void
setApiException(String apiName, Exception error) → void
setMock(String apiName, MockAPIResponse response) → void
toString() String
A string representation of this object.
inherited

Operators

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