description

# Timer constructor Null safety

Timer(

1. Duration duration,
2. void callback(
   )

)

Creates a new timer.

The `callback` function is invoked after the given `duration`.

## Implementation

    factory Timer(Duration duration, void Function() callback) {
      if (Zone.current == Zone.root) {
        // No need to bind the callback. We know that the root's timer will
        // be invoked in the root zone.
        return Zone.current.createTimer(duration, callback);
      }
      return Zone.current
          .createTimer(duration, Zone.current.bindCallbackGuarded(callback));
    }