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
2022-12-11 20:01:57 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
71b9aa8cbb08b87ab3daaf173f48df1e40051817
71b9aa8c
1 parent
9c8bc1a1
intercept startup errors in example
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
33 deletions
example/lib/barcode_list_scanner_controller.dart
example/lib/barcode_scanner_controller.dart
example/lib/barcode_scanner_returning_image.dart
example/lib/barcode_list_scanner_controller.dart
View file @
71b9aa8
...
...
@@ -25,23 +25,17 @@ class _BarcodeListScannerWithControllerState
);
bool
isStarted
=
true
;
MobileScannerException
?
exception
;
void
_startOrStop
()
{
if
(
isStarted
)
{
controller
.
stop
();
}
else
{
controller
.
start
().
catchError
((
error
)
{
final
exception
=
error
as
MobileScannerException
;
switch
(
exception
.
errorCode
)
{
case
MobileScannerErrorCode
.
controllerUninitialized
:
break
;
// This error code is not used by `start()`.
case
MobileScannerErrorCode
.
genericError
:
debugPrint
(
'Scanner failed to start'
);
break
;
case
MobileScannerErrorCode
.
permissionDenied
:
debugPrint
(
'Camera permission denied'
);
break
;
if
(
mounted
)
{
setState
(()
{
exception
=
error
as
MobileScannerException
;
});
}
});
}
...
...
example/lib/barcode_scanner_controller.dart
View file @
71b9aa8
...
...
@@ -25,23 +25,17 @@ class _BarcodeScannerWithControllerState
);
bool
isStarted
=
true
;
MobileScannerException
?
exception
;
void
_startOrStop
()
{
if
(
isStarted
)
{
controller
.
stop
();
}
else
{
controller
.
start
().
catchError
((
error
)
{
final
exception
=
error
as
MobileScannerException
;
switch
(
exception
.
errorCode
)
{
case
MobileScannerErrorCode
.
controllerUninitialized
:
break
;
// This error code is not used by `start()`.
case
MobileScannerErrorCode
.
genericError
:
debugPrint
(
'Scanner failed to start'
);
break
;
case
MobileScannerErrorCode
.
permissionDenied
:
debugPrint
(
'Camera permission denied'
);
break
;
if
(
mounted
)
{
setState
(()
{
exception
=
error
as
MobileScannerException
;
});
}
});
}
...
...
example/lib/barcode_scanner_returning_image.dart
View file @
71b9aa8
...
...
@@ -27,23 +27,17 @@ class _BarcodeScannerReturningImageState
);
bool
isStarted
=
true
;
MobileScannerException
?
exception
;
void
_startOrStop
()
{
if
(
isStarted
)
{
controller
.
stop
();
}
else
{
controller
.
start
().
catchError
((
error
)
{
final
exception
=
error
as
MobileScannerException
;
switch
(
exception
.
errorCode
)
{
case
MobileScannerErrorCode
.
controllerUninitialized
:
break
;
// This error code is not used by `start()`.
case
MobileScannerErrorCode
.
genericError
:
debugPrint
(
'Scanner failed to start'
);
break
;
case
MobileScannerErrorCode
.
permissionDenied
:
debugPrint
(
'Camera permission denied'
);
break
;
if
(
mounted
)
{
setState
(()
{
exception
=
error
as
MobileScannerException
;
});
}
});
}
...
...
Please
register
or
login
to post a comment