measureMs static method

Future<double> measureMs(
  1. Future<void> fn()
)

Measure execution time of async code block

Implementation

static Future<double> measureMs(Future<void> Function() fn) async {
  final sw = Stopwatch()..start();
  await fn();
  sw.stop();
  return sw.elapsedMicroseconds / 1000.0;
}