dumpWaves method

WaveformService dumpWaves({
  1. String outputPath = 'waves.vcd',
})

Attaches waveform dumping for this Module to a VCD at outputPath.

This quick file-dump API uses bounded memory. For debugger capture, filtering, alternative formats, or retained history, create a WaveformService directly.

Implementation

WaveformService dumpWaves({String outputPath = 'waves.vcd'}) {
  final normalized = outputPath.replaceAll(r'\', '/');
  final separatorIndex = normalized.lastIndexOf('/');
  final outputDirectory = switch (separatorIndex) {
    -1 => '.',
    0 => '/',
    _ => normalized.substring(0, separatorIndex)
  };
  final outputFileName = normalized.substring(separatorIndex + 1);

  return WaveformService(this,
      outputDirectory: outputDirectory,
      outputFileName: outputFileName,
      writeToFile: true);
}