Skip to content

Commit

Permalink
Use js_util.callMethod rather than calling methods directly on the dy…
Browse files Browse the repository at this point in the history
…namic javascript types because the resulting code does not work when building web in release mode.
  • Loading branch information
Steve Browne committed Jul 5, 2022
1 parent 9384f07 commit 5a8818b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/src/client/transport/fetch_transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,17 @@ class FetchHttpRequest {
onErrorController.add(status);
}

final reader = body?.getReader();
final stream = body;
final reader =
stream != null ? js_util.callMethod(stream, 'getReader', []) : null;
if (reader == null) {
onErrorController.add(0);
return;
}

while (true) {
final result = await js_util.promiseToFuture(reader.read());
final result =
await js_util.promiseToFuture(js_util.callMethod(reader, 'read', []));
if (_cancelableSend?.isCanceled ?? false) {
return;
}
Expand Down

0 comments on commit 5a8818b

Please sign in to comment.