timeSync<T> method Null safety

T timeSync <T>(
  1. String name,
  2. TimelineSyncFunction<T> function,
  3. {Map? arguments,
  4. Flow? flow}
)

A utility method to time a synchronous function. Internally calls function bracketed by calls to startSync and finishSync.

Implementation

static T timeSync<T>(String name, TimelineSyncFunction<T> function,
    {Map? arguments, Flow? flow}) {
  startSync(name, arguments: arguments, flow: flow);
  try {
    return function();
  } finally {
    finishSync();
  }
}