Home > Software design >  Timer is not worked in background flutter
Timer is not worked in background flutter

Time:01-03

This code is not printed, when app go to background in iOS.

Timer.periodic(Duration(seconds: 1), (timer) { print('timer'); }

I need to save state to database and play sound after finishing timer. But timer counter minimum is 1 minute. So it means at minimum after 1 minute timer will be finished. This value will be set by user. During this interval device maybe locked. Even if device is locked, app must save state after finishing timer.

CodePudding user response:

Running dart code in background is not a trivial task. You can read this: enter image description here

I get silence sounds from here.

  • Related