sendCommand method

Future<WipResponse> sendCommand(
  1. String method, [
  2. Map<String, dynamic>? params
])

Implementation

Future<WipResponse> sendCommand(
  String method, [
  Map<String, dynamic>? params,
]) {
  var completer = Completer<WipResponse>();
  var json = {'id': _nextId++, 'method': method};
  if (params != null) {
    json['params'] = params;
  }
  _completers[json['id'] as int] = completer;
  String message = jsonEncode(json);
  _ws.add(message);
  _onSend.add(message);
  return completer.future;
}