Navaron Bracke

fix thisArg for callAsFunction() calls

@@ -162,7 +162,7 @@ final class ZXingBarcodeReader extends BarcodeReader { @@ -162,7 +162,7 @@ final class ZXingBarcodeReader extends BarcodeReader {
162 162
163 if (stream != null) { 163 if (stream != null) {
164 final JSPromise? result = _reader?.attachStreamToVideo.callAsFunction( 164 final JSPromise? result = _reader?.attachStreamToVideo.callAsFunction(
165 - null, 165 + _reader as JSAny?,
166 stream as JSAny, 166 stream as JSAny,
167 videoElement as JSAny, 167 videoElement as JSAny,
168 ) as JSPromise?; 168 ) as JSPromise?;
@@ -184,7 +184,7 @@ final class ZXingBarcodeReader extends BarcodeReader { @@ -184,7 +184,7 @@ final class ZXingBarcodeReader extends BarcodeReader {
184 184
185 controller.onListen = () { 185 controller.onListen = () {
186 _reader?.decodeContinuously.callAsFunction( 186 _reader?.decodeContinuously.callAsFunction(
187 - null, 187 + _reader as JSAny?,
188 _reader?.videoElement as JSAny?, 188 _reader?.videoElement as JSAny?,
189 (Result? result, JSAny? error) { 189 (Result? result, JSAny? error) {
190 if (!controller.isClosed && result != null) { 190 if (!controller.isClosed && result != null) {
@@ -202,8 +202,8 @@ final class ZXingBarcodeReader extends BarcodeReader { @@ -202,8 +202,8 @@ final class ZXingBarcodeReader extends BarcodeReader {
202 // when the stream subscription returned by this method is cancelled in `MobileScannerWeb.stop()`. 202 // when the stream subscription returned by this method is cancelled in `MobileScannerWeb.stop()`.
203 // This avoids both leaving the barcode scanner running and a memory leak for the stream subscription. 203 // This avoids both leaving the barcode scanner running and a memory leak for the stream subscription.
204 controller.onCancel = () async { 204 controller.onCancel = () async {
205 - _reader?.stopContinuousDecode.callAsFunction();  
206 - _reader?.reset.callAsFunction(); 205 + _reader?.stopContinuousDecode.callAsFunction(_reader as JSAny?);
  206 + _reader?.reset.callAsFunction(_reader as JSAny?);
207 await controller.close(); 207 await controller.close();
208 }; 208 };
209 209
@@ -285,8 +285,8 @@ final class ZXingBarcodeReader extends BarcodeReader { @@ -285,8 +285,8 @@ final class ZXingBarcodeReader extends BarcodeReader {
285 @override 285 @override
286 Future<void> stop() async { 286 Future<void> stop() async {
287 _onMediaTrackSettingsChanged = null; 287 _onMediaTrackSettingsChanged = null;
288 - _reader?.stopContinuousDecode.callAsFunction();  
289 - _reader?.reset.callAsFunction(); 288 + _reader?.stopContinuousDecode.callAsFunction(_reader as JSAny?);
  289 + _reader?.reset.callAsFunction(_reader as JSAny?);
290 _reader = null; 290 _reader = null;
291 } 291 }
292 } 292 }