start static method

Future<void> start(
  1. String traceFilePath, {
  2. FileSystem? fs,
})

Start a recording session.

Implementation

static Future<void> start(String traceFilePath, {FileSystem? fs}) async {
  if (isEnabled) return;

  final fileSystem = fs ?? getDefaultFileSystem();
  _baseEpochUs = DateTime.now().microsecondsSinceEpoch;
  _stopwatch.reset();
  _stopwatch.start();

  _sink = createTracerSink(fileSystem, traceFilePath, _baseEpochUs);

  // Synchronize the current string table with the sink
  if (_idToStringList.isNotEmpty) {
    _sink!.add(_createBuffer(0), List.from(_idToStringList));
  }

  isEnabled = true;
}