Skip to content

Commit 5a8818b

Browse files
author
Steve Browne
committed
Use js_util.callMethod rather than calling methods directly on the dynamic javascript types because the resulting code does not work when building web in release mode.
1 parent 9384f07 commit 5a8818b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/src/client/transport/fetch_transport.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,17 @@ class FetchHttpRequest {
179179
onErrorController.add(status);
180180
}
181181

182-
final reader = body?.getReader();
182+
final stream = body;
183+
final reader =
184+
stream != null ? js_util.callMethod(stream, 'getReader', []) : null;
183185
if (reader == null) {
184186
onErrorController.add(0);
185187
return;
186188
}
187189

188190
while (true) {
189-
final result = await js_util.promiseToFuture(reader.read());
191+
final result =
192+
await js_util.promiseToFuture(js_util.callMethod(reader, 'read', []));
190193
if (_cancelableSend?.isCanceled ?? false) {
191194
return;
192195
}

0 commit comments

Comments
 (0)