Future<Timeline> traceAction(Future action(), { List<TimelineStream> streams: _defaultStreams })

Runs action and outputs a performance trace for it.

Waits for the Future returned by action to complete prior to stopping the trace.

This is merely a convenience wrapper on top of startTracing and stopTracingAndDownloadTimeline.

streams limits the recorded timeline event streams to only the ones listed. By default, all streams are recorded.

Source

Future<Timeline> traceAction(Future<dynamic> action(), { List<TimelineStream> streams: _defaultStreams }) async {
  await startTracing(streams: streams);
  await action();
  return stopTracingAndDownloadTimeline();
}