-
Notifications
You must be signed in to change notification settings - Fork 161
Open
Description
Hi there
Bug Report: App crashes when triggering event with a map data type on private channel
Description
I get this error when I try to trigger an event for a private channel:
Could not cast value of type '__NSDictionaryM' (0x10e189548) to 'NSString' (0x10e1819f0).
After this error, the app crashes.
Code Sample
Here is the code I'm using that causes the error:
await _pusher.trigger(
PusherEvent(
channelName: 'private-$channelId',
eventName: 'client-$event',
data: { 'some': 'map', 'data': 'example' },
),
);
If I use a string instead of a map for the data
parameter, no error is thrown, and the event works fine:
await _pusher.trigger(
PusherEvent(
channelName: 'private-$channelId',
eventName: 'client-$event',
data: 'some string',
),
);
Additional Information
- Subscription to the channel was successful:
LOG: onEvent: { channelName: private-77a90cc0-a3a6-4d35-a7bc-ba8abaacd8eb, eventName: pusher:subscription_succeeded, data: {}, userId: null }
Expected Behavior
The data
parameter for the triggerEvent
method is of dynamic
type, so I assume it should accept different data types, including maps. I expect that using a map for data
shouldn't crash the app. Ideally, the framework should handle the error or throw an exception instead of causing a crash.
Wrapping the code in a try-catch
block did not help in catching the error.
Environment
- Platform: [iOS]
- Framework: [2.2.1]
- Language: Dart/Flutter
Metadata
Metadata
Assignees
Labels
No labels