Navaron Bracke

remove allowInterop wrapping on JSFunction types

import 'dart:async';
import 'dart:js';
import 'dart:js_interop';
import 'dart:ui';
... ... @@ -70,13 +69,13 @@ abstract class BarcodeReader {
..lang = 'javascript'
..crossOrigin = 'anonymous'
..src = alternateScriptUrl ?? scriptUrl
..onload = allowInterop((JSAny _) {
..onload = (JSAny _) {
if (!completer.isCompleted) {
completer.complete();
}
}).toJS;
}.toJS;
script.onerror = allowInterop((JSAny _) {
script.onerror = (JSAny _) {
if (!completer.isCompleted) {
// Remove the script if it did not load.
document.head!.removeChild(script);
... ... @@ -91,7 +90,7 @@ abstract class BarcodeReader {
),
);
}
}).toJS;
}.toJS;
document.head!.appendChild(script);
... ...
import 'dart:async';
import 'dart:js';
import 'dart:js_interop';
import 'dart:ui';
... ... @@ -182,7 +181,7 @@ final class ZXingBarcodeReader extends BarcodeReader {
_reader?.decodeContinuously.callAsFunction(
null,
_reader?.videoElement,
allowInterop((Result? result, JSAny? error) {
(Result? result, JSAny? error) {
if (!controller.isClosed && result != null) {
controller.add(
BarcodeCapture(
... ... @@ -190,7 +189,7 @@ final class ZXingBarcodeReader extends BarcodeReader {
),
);
}
}).toJS,
}.toJS,
);
};
... ...