Skip to content

Commit

Permalink
Fix JS value to Dart conversion when receiving from a web socket
Browse files Browse the repository at this point in the history
  • Loading branch information
osa1 committed Nov 30, 2023
1 parent 67bf9a3 commit 1f34c30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/html.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ class HtmlWebSocketChannel extends StreamChannelMixin
}

void _innerListen(MessageEvent event) {
final eventData = event.data;
final JSAny? eventData = event.data;
Object? data;
if (eventData.typeofEquals('object') &&
(eventData as JSObject).instanceOfString('ArrayBuffer')) {
data = (eventData as JSArrayBuffer).toDart.asUint8List();
} else {
data = event.data;
data = event.data.dartify();
}
_controller.local.sink.add(data);
}
Expand Down

0 comments on commit 1f34c30

Please sign in to comment.