MobileScannerController class

The controller for the MobileScanner widget.

Inheritance

Constructors

MobileScannerController({bool autoStart = true, Size? cameraResolution, CameraLensType lensType = CameraLensType.any, DetectionSpeed detectionSpeed = DetectionSpeed.normal, int detectionTimeoutMs = 250, CameraFacing facing = CameraFacing.back, List<BarcodeFormat> formats = const <BarcodeFormat>[], bool returnImage = false, bool torchEnabled = false, bool invertImage = false, bool autoZoom = false, double? initialZoom})
Construct a new MobileScannerController instance.

Properties

autoStart → bool
Automatically start the scanner on initialization.
final
autoZoom → bool
Whether the camera should auto zoom if the detected code is to far from the camera.
final
barcodes → Stream<BarcodeCapture>
Get the stream of scanned barcodes.
no setter
cameraResolution → Size?
The desired resolution for the camera.
final
detectionSpeed → DetectionSpeed
The detection speed for the scanner.
final
detectionTimeoutMs → int
The detection timeout, in milliseconds, for the scanner.
final
facing → CameraFacing
The facing direction for the camera.
final
formats → List<BarcodeFormat>
The formats that the scanner should detect.
final
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
initialZoom → double?
The initial zoom scale for the camera.
final
invertImage → bool
Invert image colors for analyzer to support white-on-black barcodes, which are not supported by MLKit. Usage of this parameter can incur a performance cost, as frames need to be altered during processing.
final
lensType → CameraLensType
The lens type for the camera.
final
returnImage → bool
Whether the BarcodeCapture.image bytes should be provided.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
torchEnabled → bool
Whether the flashlight should be turned on when the camera is started.
final
value ↔ MobileScannerState
The current value stored in this notifier.
getter/setter pairinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
analyzeImage(String path, {List<BarcodeFormat> formats = const <BarcodeFormat>[]}) → Future<BarcodeCapture?>
Analyze an image file.
buildCameraView() → Widget
Build a camera preview widget.
dispose() → Future<void>
Dispose the controller.
override
getBestCloseRangeScanningLens({CameraFacing facing = CameraFacing.back}) → Future<CameraLensType?>
Determine the lens type best suited for close-range scanning.
getSupportedLenses({CameraFacing? facing}) → Future<Set<CameraLensType>>
Get the set of supported camera lens types for the current device.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
pause() → Future<void>
Pause the camera.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
resetZoomScale() → Future<void>
Reset the zoom scale of the camera.
setFocusPoint(Offset position) → Future<void>
Set the focus point for the camera.
setZoomScale(double zoomScale) → Future<void>
Set the zoom scale of the camera.
start({CameraFacing? cameraDirection, CameraLensType? cameraLensType}) → Future<void>
Start scanning for barcodes.
stop() → Future<void>
Stop the camera.
switchCamera([SwitchCameraOption option = const ToggleDirection()]) → Future<void>
Switch the camera based on the given option.
toggleTorch() → Future<void>
Switches the flashlight on or off.
toString() → String
A string representation of this object.
inherited
updateScanWindow(Rect? window) → Future<void>
Update the scan window with the given window rectangle.

Operators

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

Static Methods

resetPlatformSessionOwner() → void
Reset the shared platform camera session owner.