Question : flutter run code every second
Answered by : faiz-ahmad-dae
Timer timer;
@override
void initState() { super.initState(); timer = Timer.periodic(Duration(seconds: 15), (Timer t) => checkForNewSharedLists());
}
@override
void dispose() { timer?.cancel(); super.dispose();
}
Source : https://stackoverflow.com/questions/52569602/flutter-run-function-every-x-amount-of-seconds | Last Update : Sat, 05 Jun 21
Question : flutter run in background every second
Answered by : doubtful-dotterel
Timer timer;
@override
void initState() { super.initState(); timer = Timer.periodic(Duration(seconds: 15), (Timer t) => checkForNewSharedLists());
}
@override
void dispose() { timer?.cancel(); super.dispose();
}
Source : https://stackoverflow.com/questions/52569602/flutter-run-function-every-x-amount-of-seconds | Last Update : Mon, 27 Jan 20