timer method
callback to be executed again after duration.
The start time and the current time DateTime are passed so that processing can be performed based on them.
If name is specified, it can be registered as a separate task.
duration後に再度実行されるcallbackを実行します。
開始時刻と現在時刻のDateTimeが渡されるのでそれを元に処理を行うことができます。
nameを指定すると別のタスクとして登録することができます。
Implementation
Timer? timer(
FutureOr<void> Function(DateTime currentTime, DateTime startTime)
callback, {
required Duration duration,
Object? name,
}) {
return getScopedValue<Timer?, _TimerValue>(
(ref) => _TimerValue(
callback: callback,
duration: duration,
),
listen: true,
name: name,
);
}