flutter run in background every second code example
Example: flutter run in background every second
Timer timer;
void initState() {
super.initState();
timer = Timer.periodic(Duration(seconds: 15), (Timer t) => checkForNewSharedLists());
}
void dispose() {
timer?.cancel();
super.dispose();
}