DCVCameraEnhancer Class
The class provides camera control APIs.
Property | Description |
---|---|
createInstance |
Create a camera enhancer instance. |
open |
Open the camera. |
close |
Close the camera. |
selectCamera |
Select a camera (front-facing or back-facing camera). |
turnOnTorch |
Turn on the torch. |
turnOffTorch |
Turn off the torch. |
setScanRegion |
The property for users to specify the region of interest. |
createInstance
Create a camera enhancer instance.
static Future<DCVCameraEnhancer> createInstance() async;
Return Value
A camera enhancer instance.
Code Snippet
late final DCVCameraEnhancer _cameraEnhancer;
_cameraEnhancer = await DCVCameraEnhancer.createInstance();
open
Open the camera.
Future open()
close
Close the camera.
Future close()
selectCamera
Select a camera (front-facing or back-facing camera).
Future selectCamera(EnumCameraPosition position)
Parameters
position
: A Enumeration value that specify the camera position. User can either select the front facing camera or the back-facing camera.
Code Snippet
late final DCVCameraEnhancer _cameraEnhancer;
_cameraEnhancer = await DCVCameraEnhancer.createInstance();
await _cameraEnhancer.selectCamera(EnumCameraPosition.CP_FRONT)
turnOnTorch
Turn on the torch.
Future turnOnTorch()
Code Snippet
// Turn on the torch
_cameraEnhancer.turnOnTorch();
// Turn off the torch
_cameraEnhancer.turnOffTorch();
turnOffTorch
Turn off the torch.
Future turnOffTorch()
setScanRegion
The property for users to specify the region of interest.
Future setScanRegion(Region scanRegion)
Code Snippet
final DCVCameraEnhancer _cameraEnhancer = await DCVCameraEnhancer.createInstance();
Region scanRegion = Region(regionTop: 20, regionBottom: 80, regionLeft: 20, regionRight: 80, regionMeasuredByPercentage: true);
_cameraEnhancer.setScanRegion(scanRegion);