timed static method

void timed(
  1. String actionName,
  2. {required void action(
      ),
    1. void onDone(
      1. Duration time
      )?}
    )

    Implementation

    static void timed(String actionName,
        {required void Function() action,
        void Function(Duration time)? onDone}) {
      final Stopwatch sw = Stopwatch()..start();
      action();
      sw.stop();
      if (onDone != null) {
        onDone(sw.elapsed);
      } else {
        Debug().watchdog("** Action $actionName took ${sw.elapsed}");
      }
    }