I really dont find any answers to my problem. I want to execute code when a boolean is true.
I think this is what explains the situation best:
This is what works kinda wrong, since the Timer is executed all the time:
@override
initState() {
super.initState();
Timer.periodic(const Duration(milliseconds: 3000), (timer) { setState((){}); });
}
What I want is, that the Timer executes after the bool "isIPAdressSet" is true. I thought of something like that, but it gives errors:
@override
initState() {
super.initState();
_updateMethod();
}
Future<Timer> _updateMethod() async {
await isIPAddressSet == true; //'await' applied to 'bool', which is not a 'Future'
return Timer.periodic(const Duration(milliseconds: 3000), (timer) { setState((){}); });
}
Also, if the solution is something completely different, from what i thought, thats fine as well.