writeTimelineToFile method
Writes all of the recorded timeline data to a file.
By default, this will dump summaryJson to a companion file named
$traceName.timeline_summary.json
. If you want to skip the summary, set
the includeSummary
parameter to false.
See also:
- Timeline.fromJson, which explains detail about the timeline data.
Implementation
Future<void> writeTimelineToFile(
String traceName, {
String? destinationDirectory,
bool pretty = false,
bool includeSummary = true,
}) async {
destinationDirectory ??= testOutputsDirectory;
await fs.directory(destinationDirectory).create(recursive: true);
final File file = fs.file(path.join(destinationDirectory, '$traceName.timeline.json'));
await file.writeAsString(_encodeJson(_timeline.json, pretty));
if (includeSummary) {
await _writeSummaryToFile(traceName, destinationDirectory: destinationDirectory, pretty: pretty);
}
}