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
2023-12-29 12:28:15 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
eeacd392ee1b5f48884966a8c4a9749bc356150b
eeacd392
1 parent
7fc83a3c
add comment for barcode reader cancel on web
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletions
lib/src/web/mobile_scanner_web.dart
lib/src/web/zxing/zxing_barcode_reader.dart
lib/src/web/mobile_scanner_web.dart
View file @
eeacd39
...
...
@@ -148,7 +148,8 @@ class MobileScannerWeb extends MobileScannerPlatform {
return
;
}
_barcodesSubscription
?.
cancel
();
// Ensure the barcode scanner is stopped, by cancelling the subscription.
await
_barcodesSubscription
?.
cancel
();
_barcodesSubscription
=
null
;
await
_barcodeReader
.
stop
();
...
...
lib/src/web/zxing/zxing_barcode_reader.dart
View file @
eeacd39
...
...
@@ -160,6 +160,9 @@ final class ZXingBarcodeReader extends BarcodeReader {
);
};
// The onCancel() method of the controller is called
// when the stream subscription returned by this method is cancelled in `MobileScannerWeb.stop()`.
// This avoids both leaving the barcode scanner running and a memory leak for the stream subscription.
controller
.
onCancel
=
()
async
{
_reader
?.
stopContinuousDecode
.
callAsFunction
();
_reader
?.
reset
.
callAsFunction
();
...
...
Please
register
or
login
to post a comment