StubOfflineFirstWithRest.fromFiles constructor

StubOfflineFirstWithRest.fromFiles(
  1. String baseEndpoint,
  2. Map<String, String> endpointsAndFilePaths
)

Provide a list of responses from a list of endpoints, for example:

{
  'my-endpoint': 'my-endpoint.json'
}

Responses will be returned on all HTTP methods. The filePath is relative to the top-level /test directory.

Implementation

factory StubOfflineFirstWithRest.fromFiles(
  String baseEndpoint,
  Map<String, String> endpointsAndFilePaths,
) {
  final responses = endpointsAndFilePaths.entries.map((entry) {
    return StubOfflineFirstRestResponse.fromFile(entry.value, endpoint: entry.key);
  }).toList();

  return StubOfflineFirstWithRest(responses: responses, baseEndpoint: baseEndpoint);
}