timeSync<T> 静态方法

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

用于计时一个同步的 function 的实用方法。内部调用 function,并在 startSyncfinishSync 的调用之间进行。

实现

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