Skip to content

Instantly share code, notes, and snippets.

@boriscy
Created October 20, 2021 20:47
Show Gist options
  • Save boriscy/0064d23c89268748053eed5fffc793b8 to your computer and use it in GitHub Desktop.
Save boriscy/0064d23c89268748053eed5fffc793b8 to your computer and use it in GitHub Desktop.
import 'dart:async';
void main() {
var duration = Duration(milliseconds: 500);
var t = Timer.periodic(duration, (Timer t) {
print('Update ${t}');
});
print(t.isActive);
var d2 = Duration(seconds: 2);
Timer(d2, () {
t.cancel();
print(t.isActive);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment