Future<dynamic> refreshState() async {
setState(() {});
await Future<dynamic>.delayed(animDuration + const Duration(milliseconds: 50));
if (isPlaying) {
await refreshState();
}
}
currently refreshState() is running non-stop. I want refreshState to run for 1 sec, then stop. I assume I need to set isPlaying = !isPlaying at some point but where?
Thanks!