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-04-08 16:39:57 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ec7d69f6997b9ec4045a381bfa9c5c9c913eb09f
ec7d69f6
1 parent
3cf8f553
fix bug with permissions on Android
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
lib/src/mobile_scanner_controller.dart
lib/src/mobile_scanner_controller.dart
View file @
ec7d69f
...
...
@@ -223,12 +223,14 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
}
/// Start scanning for barcodes.
/// Upon calling this method, the necessary camera permission will be requested.
///
/// The [cameraDirection] can be used to specify the camera direction.
/// If this is null, this defaults to the [facing] value.
///
/// Does nothing if the camera is already running.
/// Upon calling this method, the necessary camera permission will be requested.
///
/// If the permission is denied on iOS, MacOS or Web, there is no way to request it again.
Future
<
void
>
start
({
CameraFacing
?
cameraDirection
})
async
{
if
(
_isDisposed
)
{
throw
const
MobileScannerException
(
...
...
@@ -240,6 +242,13 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
);
}
// Permission was denied, do nothing.
// When the controller is stopped,
// the error is reset so the permission can be requested again if possible.
if
(
value
.
error
?.
errorCode
==
MobileScannerErrorCode
.
permissionDenied
)
{
return
;
}
// Do nothing if the camera is already running.
if
(
value
.
isRunning
)
{
return
;
...
...
Please
register
or
login
to post a comment