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
Julian Steenbakker
2022-12-08 11:13:33 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
084715237bb046170802edefce028d05d5b9fd35
08471523
1 parent
260b4522
feat: add autoStart parameter
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
lib/src/mobile_scanner.dart
lib/src/mobile_scanner_controller.dart
lib/src/mobile_scanner.dart
View file @
0847152
...
...
@@ -64,6 +64,12 @@ class _MobileScannerState extends State<MobileScanner>
/// Start the given [scanner].
void
_startScanner
(
MobileScannerController
scanner
)
{
if
(!
_controller
.
autoStart
)
{
debugPrint
(
'mobile_scanner: not starting automatically because autoStart is set to false in the controller.'
,
);
return
;
}
scanner
.
start
().
then
((
arguments
)
{
// ignore: deprecated_member_use_from_same_package
widget
.
onStart
?.
call
(
arguments
);
...
...
lib/src/mobile_scanner_controller.dart
View file @
0847152
...
...
@@ -19,6 +19,7 @@ class MobileScannerController {
this
.
returnImage
=
false
,
@Deprecated
(
'Instead, use the result of calling `start()` to determine if permissions were granted.'
)
this
.
onPermissionSet
,
this
.
autoStart
=
true
,
})
{
// In case a new instance is created before calling dispose()
if
(
controllerHashcode
!=
null
)
{
...
...
@@ -64,6 +65,9 @@ class MobileScannerController {
/// [DetectionSpeed.normal] (which is the default value).
final
int
detectionTimeoutMs
;
/// Automatically start the mobileScanner on initialization.
final
bool
autoStart
;
/// Sets the barcode stream
final
StreamController
<
BarcodeCapture
>
_barcodesController
=
StreamController
.
broadcast
();
...
...
Please
register
or
login
to post a comment