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-08 12:54:33 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
27d54746704cef9f1adf8e58bfd40ab66cfd6d05
27d54746
1 parent
db57d85b
return if switchCameras() would not do anything
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
lib/src/mobile_scanner_controller.dart
lib/src/mobile_scanner_controller.dart
View file @
27d5474
...
...
@@ -317,9 +317,20 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
}
/// Switch between the front and back camera.
///
/// Does nothing if the device has less than 2 cameras.
Future
<
void
>
switchCamera
()
async
{
_throwIfNotInitialized
();
final
int
?
availableCameras
=
value
.
availableCameras
;
// Do nothing if the amount of cameras is less than 2 cameras.
// If the the current platform does not provide the amount of cameras,
// continue anyway.
if
(
availableCameras
!=
null
&&
availableCameras
<
2
)
{
return
;
}
await
stop
();
final
CameraFacing
cameraDirection
=
value
.
cameraDirection
;
...
...
Please
register
or
login
to post a comment