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-29 11:08:57 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ec9c079c9a50ef937508e48f17712255dd87ee74
ec9c079c
1 parent
31e913f2
fix missing isClosed checks
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
9 deletions
lib/src/mobile_scanner_controller.dart
lib/src/web/mobile_scanner_web.dart
lib/src/web/zxing/zxing_barcode_reader.dart
lib/src/mobile_scanner_controller.dart
View file @
ec9c079
...
...
@@ -119,9 +119,11 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
void
_setupListeners
()
{
_barcodesSubscription
=
MobileScannerPlatform
.
instance
.
barcodesStream
.
listen
((
BarcodeCapture
?
barcode
)
{
if
(!
_barcodesController
.
isClosed
&&
barcode
!=
null
)
{
_barcodesController
.
add
(
barcode
);
if
(
_barcodesController
.
isClosed
||
barcode
==
null
)
{
return
;
}
_barcodesController
.
add
(
barcode
);
});
_torchStateSubscription
=
MobileScannerPlatform
.
instance
.
torchStateStream
...
...
lib/src/web/mobile_scanner_web.dart
View file @
ec9c079
...
...
@@ -113,7 +113,9 @@ class MobileScannerWeb extends MobileScannerPlatform {
try
{
// Clear the existing barcodes.
_barcodesController
.
add
(
const
BarcodeCapture
());
if
(!
_barcodesController
.
isClosed
)
{
_barcodesController
.
add
(
const
BarcodeCapture
());
}
// Listen for changes to the media track settings.
_barcodeReader
.
setMediaTrackSettingsListener
(
...
...
lib/src/web/zxing/zxing_barcode_reader.dart
View file @
ec9c079
...
...
@@ -187,13 +187,15 @@ final class ZXingBarcodeReader extends BarcodeReader {
_reader
as
JSAny
?,
_reader
?.
videoElement
as
JSAny
?,
(
Result
?
result
,
JSAny
?
error
)
{
if
(!
controller
.
isClosed
&&
result
!=
null
)
{
controller
.
add
(
BarcodeCapture
(
barcodes:
[
result
.
toBarcode
],
),
);
if
(
controller
.
isClosed
||
result
==
null
)
{
return
;
}
controller
.
add
(
BarcodeCapture
(
barcodes:
[
result
.
toBarcode
],
),
);
}.
toJS
,
);
};
...
...
Please
register
or
login
to post a comment