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
I encountered an issue in the notifyOutgoingListeners method (located in lib/src/socket.dart on line 318).
Here's the listener code I used:
socket.onAnyOutgoing((event, data) {
});
And here's the error I got:
NoSuchMethodError: Closure call with mismatched arguments: function 'SocketIoManager._initSocketListeners.<anonymous closure>'
Receiver: Closure: (String, dynamic) => Null
Tried calling: SocketIoManager._initSocketListeners.<anonymous closure>(Instance(length:2) of '_GrowableList')
Found: SocketIoManager._initSocketListeners.<anonymous closure>(String, dynamic) => Null
The issue seems to happen because of how arguments are passed in this part of the code:
voidnotifyOutgoingListeners(Map packet) {
if (_anyOutgoingListeners.isNotEmpty) {
final listeners =List.from(_anyOutgoingListeners);
for (final listener in listeners) {
Function.apply(listener, [packet['data']]);
}
}
}
Right now, the arguments are wrapped in square brackets ([packet['data']]), which causes the mismatch. If I remove the brackets, the error goes away, and everything works fine:
voidnotifyOutgoingListeners(Map packet) {
if (_anyOutgoingListeners.isNotEmpty) {
final listeners =List.from(_anyOutgoingListeners);
for (final listener in listeners) {
Function.apply(listener, packet['data']);
}
}
}
Steps to Reproduce:
Add a listener using onAnyOutgoing.
Send any outgoing event.
The error will occur due to argument mismatch.
Solution:
Removing the square brackets around packet['data'] in the notifyOutgoingListeners method fixes the issue and passes the arguments correctly.
The text was updated successfully, but these errors were encountered:
I encountered an issue in the
notifyOutgoingListeners
method (located in lib/src/socket.dart on line 318).Here's the listener code I used:
socket.onAnyOutgoing((event, data) { });
And here's the error I got:
The issue seems to happen because of how arguments are passed in this part of the code:
Right now, the arguments are wrapped in square brackets (
[packet['data']]
), which causes the mismatch. If I remove the brackets, the error goes away, and everything works fine:Steps to Reproduce:
onAnyOutgoing
.Solution:
Removing the square brackets around
packet['data']
in thenotifyOutgoingListeners
method fixes the issue and passes the arguments correctly.The text was updated successfully, but these errors were encountered: