run static method

void run(
  1. String tag,
  2. Duration duration,
  3. VoidCallback action
)

Runs the action after the specified duration.

If the same tag is provided before the timer expires, the previous timer is cancelled and a new one starts.

Implementation

static void run(String tag, Duration duration, VoidCallback action) {
  _timers[tag]?.cancel();
  _timers[tag] = Timer(duration, () {
    action();
    _timers.remove(tag);
  });
}