writeResponseData function
Writes a json-serializable data to
testOutputsDirectory/testOutputFilename.json
.
This is the default responseDataCallback
in integrationDriver.
Implementation
Future<void> writeResponseData(
Map<String, dynamic>? data, {
String testOutputFilename = 'integration_response_data',
String? destinationDirectory,
}) async {
destinationDirectory ??= testOutputsDirectory;
await fs.directory(destinationDirectory).create(recursive: true);
final File file = fs.file(path.join(
destinationDirectory,
'$testOutputFilename.json',
));
final String resultString = _encodeJson(data, true);
await file.writeAsString(resultString);
}