writeTimelineToFile method Null safety

Future<void> writeTimelineToFile(
  1. String traceName,
  2. {String? destinationDirectory,
  3. bool pretty = false,
  4. bool includeSummary = true}
)

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:

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);
  }
}