This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
void main() { | |
Future getName() async { | |
// 打印时钟 | |
Timer.periodic(new Duration(seconds: 1), (timer) { | |
final tick = timer.tick; | |
print('时间过去$tick秒'); | |
if (tick >= 5) { | |
timer.cancel(); |