sendMethodResult method

void sendMethodResult(
  1. int id,
  2. Map<String, dynamic> result
)

Implementation

void sendMethodResult(int id, Map<String, dynamic> result) {
  // Find the connection that made this request
  // For now, broadcast to all connections
  final response = {
    'id': id,
    'result': result,
  };

  final message = jsonEncode(response);

  for (final connection in _connections.values) {
    try {
      connection.sink.add(message);
    } catch (e) {
      print('Error sending result: $e');
    }
  }
}