简体   繁体   中英

Flutter Timer Duration

How do I watch the Timer Duration to do something after a specific number of minutes/seconds before it ends? var duration = Duration(seconds: time); Which will end in an hour. I want for example when time passed 30 minutes call a function OR anything else.

You can use Future.delayed(...)

new Future.delayed(const Duration(seconds: time), () {
  // deleayed code here 
  print('delayed execution');
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM