writeResponseData function Null safety
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 {
assert(testOutputFilename != null);
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);
}