Skip to content

Instantly share code, notes, and snippets.

@sfmskywalker
Last active October 31, 2021 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sfmskywalker/24e9e30b38d0bf8a8c453e7b38051514 to your computer and use it in GitHub Desktop.
Save sfmskywalker/24e9e30b38d0bf8a8c453e7b38051514 to your computer and use it in GitHub Desktop.
Flutter recurring task
Future<void> delay(int milliseconds, Function callback) async {
await Future.delayed(Duration(milliseconds: milliseconds));
callback();
}
void doTask() {
print('Hello!');
delay(1000, DoTask);
}
doTask();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment