U.jung
U.jung

Reputation: 15

flutter timer periodic with starting 00 min

After setting, I want this checking to be started HH:00, not just after 1 min from set. Do you have any idea of it?

 Timer runAlarm() {
    return Timer.periodic(Duration(minutes: 1), (timer) async {
      workTodo();
  }

Upvotes: 1

Views: 979

Answers (1)

Md. Yeasin Sheikh
Md. Yeasin Sheikh

Reputation: 63799

The concept to get data on start point will be calling the work method before assigning the timer.

  workToDo() {
    print("data");
  }

  Timer runAlarm() {
    workToDo();
    return Timer.periodic(duration, (timer) {
      workToDo();
    });
  }

Upvotes: 2

Related Questions