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-06 19:49:01 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
035590ac8e318b84f8db0140e3acc40a8ee8cfcf
035590ac
1 parent
0bcca09b
guard against disposed controller during state updates
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
lib/src/mobile_scanner_controller.dart
lib/src/mobile_scanner_controller.dart
View file @
035590a
...
...
@@ -119,18 +119,26 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
void
_setupListeners
()
{
_barcodesSubscription
=
MobileScannerPlatform
.
instance
.
barcodesStream
.
listen
((
BarcodeCapture
?
barcode
)
{
if
(
barcode
!=
null
)
{
if
(
!
_barcodesController
.
isClosed
&&
barcode
!=
null
)
{
_barcodesController
.
add
(
barcode
);
}
});
_torchStateSubscription
=
MobileScannerPlatform
.
instance
.
torchStateStream
.
listen
((
TorchState
torchState
)
{
if
(
_isDisposed
)
{
return
;
}
value
=
value
.
copyWith
(
torchState:
torchState
);
});
_zoomScaleSubscription
=
MobileScannerPlatform
.
instance
.
zoomScaleStateStream
.
listen
((
double
zoomScale
)
{
if
(
_isDisposed
)
{
return
;
}
value
=
value
.
copyWith
(
zoomScale:
zoomScale
);
});
}
...
...
Please
register
or
login
to post a comment