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.

This commit is contained in:
Steve Browne 2022-07-05 12:22:15 -04:00
parent 9384f07cdf
commit 5a8818b527
1 changed files with 5 additions and 2 deletions

View File

@ -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;
}