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-06-18 09:54:18 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
196a4b0f95d01f03d6ede9f6c108cd3833f89161
196a4b0f
1 parent
51808122
forward scan errors to the controller
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
lib/src/mobile_scanner_controller.dart
lib/src/mobile_scanner_controller.dart
View file @
196a4b0
...
...
@@ -124,14 +124,25 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
}
void
_setupListeners
()
{
_barcodesSubscription
=
MobileScannerPlatform
.
instance
.
barcodesStream
.
listen
((
BarcodeCapture
?
barcode
)
{
if
(
_barcodesController
.
isClosed
||
barcode
==
null
)
{
return
;
}
_barcodesController
.
add
(
barcode
);
});
_barcodesSubscription
=
MobileScannerPlatform
.
instance
.
barcodesStream
.
listen
(
(
BarcodeCapture
?
barcode
)
{
if
(
_barcodesController
.
isClosed
||
barcode
==
null
)
{
return
;
}
_barcodesController
.
add
(
barcode
);
},
onError:
(
Object
error
)
{
if
(
_barcodesController
.
isClosed
)
{
return
;
}
_barcodesController
.
addError
(
error
);
},
// Errors are handled gracefully by forwarding them.
cancelOnError:
false
,
);
_torchStateSubscription
=
MobileScannerPlatform
.
instance
.
torchStateStream
.
listen
((
TorchState
torchState
)
{
...
...
Please
register
or
login
to post a comment