Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2024-01-25 14:08:15 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2328edc252c0b61d6acb72fe91346060e5523bcf
2328edc2
1 parent
6a57bc33
remove allowInterop wrapping on JSFunction types
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
lib/src/web/barcode_reader.dart
lib/src/web/zxing/zxing_barcode_reader.dart
lib/src/web/barcode_reader.dart
View file @
2328edc
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
);
...
...
lib/src/web/zxing/zxing_barcode_reader.dart
View file @
2328edc
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
,
);
};
...
...
Please
register
or
login
to post a comment