sendMessage method

void sendMessage(
  1. String type,
  2. dynamic data
)

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);
  }
}