sendMessage method
Implementation
void sendMessage(String type, dynamic data) {
try {
final String payload = json.encode({'type': type, 'data': data});
if (transport != null) {
transport!.send(payload);
}
} catch (error) {
print(error);
}
}