You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NoSuchMethodError: Class '_Map<String, Object>' has no instance getter 'toJson' in socket.io usage with EVENT type packets
Description
I am encountering a NoSuchMethodError with the following details:
This error occurs when I receive packets of type EVENT while using socket_io_client. To resolve this, I updated the package version from 3.0.0-beta.2 to 3.0.2 as I saw a similar issue addressed in socket_io_common. However, the issue persists in the latest version as well.
The problem seems to be related to a missing toJson method in the Map implementation. The issue likely stems from how packets are being handled or parsed within the socket library.
Steps to Reproduce
Use the socket_io_client package version 3.0.2.
Establish a socket connection to a server.
Receive a packet of type EVENT.
Observe the following error in the logs:
NoSuchMethodError:Class ‘_Map<String, Object>’ has no instance getter ‘toJson’.
Receiver:_MapTried calling: toJson
---NoSuchMethodError (NoSuchMethodError:Class'_Map<String, Object>' has no instance getter 'toJson'.
Receiver:_Map len:4Tried calling: toJson)
---NoSuchMethodError (NoSuchMethodError:Class'int' has no instance getter 'toJSON'.
Receiver:2Tried calling: toJSON)
---NoSuchMethodError (NoSuchMethodError:Class'String' has no instance getter 'toJSON'.
Receiver:"exitRoom"Tried calling: toJSON)
---NoSuchMethodError (NoSuchMethodError:Class'List<dynamic>' has no instance getter 'toJSON'.
Receiver:Instance(length:2) of '_GrowableList'Tried calling: toJSON)
The library should correctly handle or parse EVENT type packets without throwing a NoSuchMethodError. Ideally, any _Map object should be deserialized properly or handled internally.
Actual Behavior
The application throws a NoSuchMethodError when a toJson method is called on _Map<String, Object> during the handling of an EVENT type packet.
Attachments
A screenshot of the error is attached.
Example Code Snippet
socket.emit('eventName','StringValue');
The text was updated successfully, but these errors were encountered:
The implementation should ignore this error: is_binary.dart. However, I don't know why Flutter throws that error. A few weeks ago, a user encountered a similar error, and after cleaning their Flutter environment, the error disappeared.
NoSuchMethodError: Class '_Map<String, Object>' has no instance getter 'toJson'
in socket.io usage withEVENT
type packetsDescription
I am encountering a
NoSuchMethodError
with the following details:This error occurs when I receive packets of type
EVENT
while usingsocket_io_client
. To resolve this, I updated the package version from3.0.0-beta.2
to3.0.2
as I saw a similar issue addressed insocket_io_common
. However, the issue persists in the latest version as well.The problem seems to be related to a missing
toJson
method in the Map implementation. The issue likely stems from how packets are being handled or parsed within the socket library.Steps to Reproduce
socket_io_client
package version3.0.2
.EVENT
.Environment
socket_io_client
3.0.2Expected Behavior
The library should correctly handle or parse
EVENT
type packets without throwing aNoSuchMethodError
. Ideally, any_Map
object should be deserialized properly or handled internally.Actual Behavior
The application throws a
NoSuchMethodError
when atoJson
method is called on_Map<String, Object>
during the handling of anEVENT
type packet.Attachments
Example Code Snippet
The text was updated successfully, but these errors were encountered: