-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoSuchMethodError: Class '_Map<String, Object>' has no instance getter 'toJson' #403
Comments
I am getting the same issue. |
@mrasityilmaz were you able to find out any workaround? |
It’s strange; this issue should not have occurred. According to the code, all exceptions should be caught by the try-catch statement. - https://github.com/rikulo/socket_io_common/blob/master/lib/src/parser/is_binary.dart#L67-L77 FYI, a few weeks ago, someone who encountered this issue cleared his environment and rebuilt his code, and everything went well. |
This is how i call the emit method
In this screenshot its shows that Also something doesn't look right in this function https://github.com/rikulo/socket_io_common/blob/master/lib/src/parser/is_binary.dart#L67-L77 Unnecessary Nesting of Try-Catch , the code in first Try and Catch is the same as in the second try and catch without adding any value.
The old is_binary has this condition to guard .toJson again object without toJSON, and this condition not exists in latest version |
No, I couldn’t find it. There hasn’t been any progress either. |
@mrasityilmaz Can you share your forked repo when you have it? |
Maybe we can check the built in types first to see if that can help you. For example,
|
Please update socket_io_common to v3.0.2 to give it a try. - rikulo/socket_io_common#15 |
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: