socket.io-client-dart icon indicating copy to clipboard operation
socket.io-client-dart copied to clipboard

Exception has occurred.

Open mdino opened this issue 10 months ago • 3 comments

socket.onConnect((_) {
  print('Connected to server');
  socket.emit('joinGame', {'playerId': playerId, 'balance': balance, 'cpu': cpu, 'host': host,  'playerName': playerName,  'avatar': avatar});
});

Exception has occurred. DartError: NoSuchMethodError: 'toJSON' method not found Receiver: Instance of 'IdentityMap<String, Object>' Arguments: []

Why I always got exception on any socket.emit.. I try to Map it, json encode, decode (client and server side) everything and I always got the same error in visual studio.

mdino avatar Jan 22 '25 09:01 mdino

Please update socket_io_common to v3.0.2 to give it a try. - https://github.com/rikulo/socket.io-client-dart/issues/403#issuecomment-2597247726

jumperchen avatar Jan 22 '25 09:01 jumperchen

Im using socket_io_client: ^3.0.2

mdino avatar Jan 22 '25 11:01 mdino

Im using socket_io_client: ^3.0.2

No, I meant "socket_io_common"

jumperchen avatar Jan 22 '25 13:01 jumperchen