timer before next function flutter code example
Example 1: repeating action every x seconds flutter
Timer timer;
@override
void initState() {
super.initState();
timer = Timer.periodic(Duration(seconds: 15), (Timer t) => checkForNewSharedLists());
}
@override
void dispose() {
timer?.cancel();
super.dispose();
}
Example 2: timer in flutter
Future.delayed(Duration(seconds: 1), () {
print('yo hey');
});