Created
October 29, 2019 10:04
-
-
Save nkenna/5a0d56941c2d7f0658f8aa09a62fc0f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
void initState() { | |
// TODO: implement initState | |
super.initState(); | |
Timer.periodic(Duration(seconds: 100), (timer) { //ask the server for humuidity value every 100 seconds | |
print('sending periodic message: hh'); | |
widget.channel.sink.add('humidity'); // send message to server | |
setState(() { | |
humidity = humidd; // change the value of temperature with the recent result from server. | |
}); | |
}); | |
Timer.periodic(Duration(seconds: 115), (timer) { //ask the server for temperature value every 115 seconds | |
print('sending periodic message: temp'); | |
widget.channel.sink.add('temperature'); // send message to server | |
setState(() { | |
temperature = tempp; | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment