我本来希望得到下面这样的东西,但显然这行不通。
Stopwatch watch = new Stopwatch();
watch.elapsed = watch.elapsed + Duration(hours: 01, minutes: 23, seconds: 31);
有没有什么方法可以达到预期的结果?
-谢谢你的任何提示/线索。
最佳答案
Stopwatch
用于测量间隔-通常用于性能测试。也许您需要一个Timer
。或秒表子类。
Timer t = Timer(Duration(hours: 01, minutes: 23, seconds: 31), () {
print('time to take the cake out of the oven');
});
...
t.cancel(); // use this if you want to cancel the timer early
class OffsetStopwatch extends Stopwatch {
Duration offset;
OffsetStopwatch(this.offset);
Duration get offsetElapsed => offset + elapsed;
}
关于flutter - flutter :有没有办法在给定时间启动秒表类(class)?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56242937/