Created
July 7, 2019 03:35
-
-
Save ricardoogliari/dfdc30ebef100ee2b38b1f6d9f2a4dc5 to your computer and use it in GitHub Desktop.
onMessage.dart
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
void _onMessage(List<mqtt.MqttReceivedMessage> event) { | |
final mqtt.MqttPublishMessage recMess = | |
event[0].payload as mqtt.MqttPublishMessage; | |
final String message = | |
mqtt.MqttPublishPayload.bytesToStringAsString(recMess.payload.message); | |
setState(() { | |
_temp = double.parse(message); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment