MobileScannerController class

The MobileScannerController holds all the logic of this plugin, where as the MobileScanner class is the frontend of this plugin.

Constructors

MobileScannerController({CameraFacing facing = CameraFacing.back, DetectionSpeed detectionSpeed = DetectionSpeed.normal, int detectionTimeoutMs = 250, bool torchEnabled = false, List<BarcodeFormat>? formats, bool returnImage = false, @Deprecated('Instead, use the result of calling `start()` to determine if permissions were granted.') dynamic onPermissionSet(bool permissionGranted)?, bool autoStart = true, Size? cameraResolution, bool useNewCameraSelector = false})

Properties

autoStart → bool
Automatically start the mobileScanner on initialization.
final
barcodes → Stream<BarcodeCapture>
no setter
cameraFacingState → ValueNotifier<CameraFacing>
A notifier that provides the state of which camera is being used
latefinal
cameraResolution → Size?
The desired resolution for the camera.
final
detectionSpeed → DetectionSpeed
Sets the speed of detections.
final
detectionTimeoutMs → int
Sets the timeout, in milliseconds, of the scanner.
final
events ↔ StreamSubscription?
Listen to events from the platform specific code
getter/setter pair
facing → CameraFacing
Select which camera should be used.
final
formats → List<BarcodeFormat>?
If provided, the scanner will only detect those specific formats
final
hashCode → int
The hash code for this object.
no setterinherited
hasTorch → bool
Returns whether the device has a torch.
no setter
hasTorchState → ValueNotifier<bool?>
A notifier that provides availability of the Torch (Flash)
final
isStarting ↔ bool
getter/setter pair
onPermissionSet ↔ dynamic Function(bool permissionGranted)?
getter/setter pair
returnImage → bool
Set to true if you want to return the image buffer with the Barcode event
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
startArguments → ValueNotifier<MobileScannerArguments?>
A notifier that provides several arguments about the MobileScanner
final
torchEnabled → bool
Enable or disable the torch (Flash) on start
final
torchState → ValueNotifier<TorchState>
A notifier that provides the state of the Torch (Flash)
final
useNewCameraSelector → bool
Use the new resolution selector. Warning: not fully tested, may produce unwanted/zoomed images.
final
zoomScaleState → ValueNotifier<double>
A notifier that provides zoomScale.
final

Methods

analyzeImage(String path) → Future<bool>
Handles a local image file. Returns true if a barcode or QR code is found. Returns false if nothing is found.
dispose() → void
Disposes the MobileScannerController and closes all listeners.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetZoomScale() → Future<void>
Reset the zoomScale of the camera to use standard scale 1x.
setZoomScale(double zoomScale) → Future<void>
Set the zoomScale of the camera.
start({CameraFacing? cameraFacingOverride}) → Future<MobileScannerArguments?>
Start scanning for barcodes. Upon calling this method, the necessary camera permission will be requested.
stop() → Future<void>
Stops the camera, but does not dispose this controller.
switchCamera() → Future<void>
Changes the state of the camera (front or back).
toggleTorch() → Future<void>
Switches the torch on or off.
toString() → String
A string representation of this object.
inherited
updateScanWindow(Rect? window) → Future<void>
updates the native ScanWindow

Operators

operator ==(Object other) → bool
The equality operator.
inherited