indaband / pusher_channels

A pure Dart implementation of the Pusher Channels Client
https://pusher.com/channels
MIT License
8 stars 3 forks source link

Error decoding already decoded json #2

Open nicobritos opened 2 years ago

nicobritos commented 2 years ago

The onMessage method tries to decode an already decoded json payload, throwing an exception.

  void onMessage(data) {
    final json = jsonDecode(data);
    if (json.containsKey('channel')) {
      eventHandler(json['event'], json['channel'], jsonDecode(json['data']));
    } else {
      _eventCallbacks[json['event']]?.call(json['data'] ?? {});
    }
  }