respond method

void respond(
  1. {int to = 1,
  2. int result = 1,
  3. int id = 2,
  4. MessageCallback callback}
)

Implementation

void respond({
  int to = 1,
  int result = 1,
  int id = 2,
  MessageCallback callback,
}) {
  channel.sink.add(
    json.encode(
      response(
        to: to,
        result: result,
        id: id,
      ),
    ),
  );
  if (!isListening) {
    isListening = true;
    channel.stream.listen(callback ?? onMessage);
  }
}