UScanner class

Inheritance
Available extensions

Constructors

UScanner({ValueChanged<String>? onScan, ValueChanged<BarcodeCapture>? onCapture, ValueChanged<List<Barcode>>? onBarcodes, void onScanError(Object error, StackTrace stackTrace)?, MobileScannerController? controller, 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, BoxFit fit = BoxFit.cover, Widget errorBuilder(BuildContext, MobileScannerException)?, WidgetBuilder? placeholderBuilder, LayoutWidgetBuilder? overlayBuilder, Rect? scanWindow, bool restrictToScanWindow = false, double scanWindowUpdateThreshold = 0.0, bool useAppLifecycleState = true, bool tapToFocus = false, bool singleScan = true, bool hapticOnScan = true, bool showOverlay = true, Color? overlayColor, Size scanWindowSize = const Size(280, 280), Color? borderColor, double borderWidth = 3, double borderRadius = 16, double cornerLength = 32, bool showCorners = true, bool showFullBorder = false, bool showScanLine = true, Color? scanLineColor, double scanLineThickness = 2, Duration scanLineDuration = const Duration(seconds: 2), String? hintText, bool showHint = true, TextStyle? hintTextStyle, UScannerHintPosition hintPosition = UScannerHintPosition.bottom, double hintGap = 20, EdgeInsets hintPadding = const EdgeInsets.symmetric(horizontal: 14, vertical: 10), Color? hintBackgroundColor, double hintBorderRadius = 12, bool showControls = true, bool showTorchButton = true, bool showSwitchCameraButton = true, bool showGalleryButton = false, Alignment controlsAlignment = Alignment.bottomCenter, double controlsSpacing = 24, EdgeInsets controlsPadding = const EdgeInsets.only(bottom: 40), Color? controlIconColor, Color? controlActiveIconColor, Color? controlBackgroundColor, double controlButtonSize = 52, double controlIconSize = 26, IconData torchOnIcon = Icons.flash_on_rounded, IconData torchOffIcon = Icons.flash_off_rounded, IconData switchCameraIcon = Icons.cameraswitch_rounded, IconData galleryIcon = Icons.photo_library_rounded, Key? key})
const

Properties

autoStart → bool
final
autoZoom → bool
final
borderColor → Color?
final
borderRadius → double
final
borderWidth → double
final
cameraResolution → Size?
final
controlActiveIconColor → Color?
final
controlBackgroundColor → Color?
final
controlButtonSize → double
final
controlIconColor → Color?
final
controlIconSize → double
final
controller → MobileScannerController?
External controller. When provided, the controller-configuration fields (facing, formats, torchEnabled, ...) are ignored in favor of this instance.
final
controlsAlignment → Alignment
final
controlsPadding → EdgeInsets
final
controlsSpacing → double
final
cornerLength → double
final
detectionSpeed → DetectionSpeed
final
detectionTimeoutMs → int
final
errorBuilder → Widget Function(BuildContext, MobileScannerException)?
final
facing → CameraFacing
final
fit → BoxFit
final
formats → List<BarcodeFormat>
final
galleryIcon → IconData
final
hapticOnScan → bool
Fire a haptic pulse when a code is scanned.
final
hashCode → int
The hash code for this object.
no setterinherited
hintBackgroundColor → Color?
final
hintBorderRadius → double
final
hintGap → double
final
hintPadding → EdgeInsets
final
hintPosition → UScannerHintPosition
final
hintText → String?
final
hintTextStyle → TextStyle?
final
initialZoom → double?
final
invertImage → bool
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
lensType → CameraLensType
final
onBarcodes → ValueChanged<List<Barcode>>?
Called with the raw list of Barcodes for every detection.
final
onCapture → ValueChanged<BarcodeCapture>?
Called with the full BarcodeCapture for every detection.
final
onScan → ValueChanged<String>?
Called with the raw value of the first detected barcode.
final
onScanError → void Function(Object error, StackTrace stackTrace)?
Called when the scanner throws while decoding.
final
overlayBuilder → LayoutWidgetBuilder?
final
overlayColor → Color?
final
placeholderBuilder → WidgetBuilder?
final
restrictToScanWindow → bool
When true (and scanWindow is null) the detection is limited to the centered scanWindowSize rectangle.
final
returnImage → bool
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scanLineColor → Color?
final
scanLineDuration → Duration
final
scanLineThickness → double
final
scanWindow → Rect?
Explicit detection window. Overrides restrictToScanWindow.
final
scanWindowSize → Size
final
scanWindowUpdateThreshold → double
final
showControls → bool
final
showCorners → bool
final
showFullBorder → bool
final
showGalleryButton → bool
final
showHint → bool
final
showOverlay → bool
final
showScanLine → bool
final
showSwitchCameraButton → bool
final
showTorchButton → bool
final
singleScan → bool
Stop reporting after the first successful scan.
final
switchCameraIcon → IconData
final
tapToFocus → bool
final
torchEnabled → bool
final
torchOffIcon → IconData
final
torchOnIcon → IconData
final
useAppLifecycleState → bool
final

Methods

alignAtBottomCenter({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtBottomLeft({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtBottomRight({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtCenter({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtCenterLeft({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtCenterRight({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtLERP(Alignment a, Alignment b, double t, {Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtTopCenter({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtTopLeft({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtTopRight({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignXY(double x, double y, {Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

card({Color? backgroundColor, double? elevation, EdgeInsets? margin}) → Widget

Available on Widget, provided by the WidgetsExtension extension

container({double? width, double? height, Alignment? alignment, Color? backgroundColor, double borderWidth = 1, double radius = 1, Color borderColor = Colors.transparent, EdgeInsets? padding, EdgeInsets? margin, BoxConstraints? constraints}) → Widget

Available on Widget, provided by the WidgetsExtension extension

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<UScanner>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
expanded({int flex = 1}) → Widget

Available on Widget, provided by the WidgetsExtension extension

fadeSlideIn({int milliseconds = 1000, double offset = 24}) → Widget

Available on Widget, provided by the WidgetsExtension extension

fit({Alignment alignment = Alignment.center}) → Widget

Available on Widget, provided by the WidgetsExtension extension

form(GlobalKey<FormState> key) → Widget

Available on Widget, provided by the WidgetsExtension extension

ltr() → Widget

Available on Widget, provided by the WidgetsExtension extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDoubleTap(GestureTapCallback? onPressed) → Widget

Available on Widget, provided by the WidgetsExtension extension

onLongPress(GestureTapCallback? onPressed) → Widget

Available on Widget, provided by the WidgetsExtension extension

onPress(VoidCallback onTap, {double pressedScale = 0.9, Duration duration = const Duration(milliseconds: 120)}) → Widget

Available on Widget, provided by the WidgetsExtension extension

onTap(GestureTapCallback? onPressed) → Widget

Available on Widget, provided by the WidgetsExtension extension

onTapInk(GestureTapCallback? onPressed) → Widget

Available on Widget, provided by the WidgetsExtension extension

pAll(double padding) → Widget

Available on Widget, provided by the WidgetsExtension extension

pOnly({double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0}) → Widget

Available on Widget, provided by the WidgetsExtension extension

position({double? left, double? top, double? right, double? bottom, double? width, double? height}) → Widget

Available on Widget, provided by the WidgetsExtension extension

pSymmetric({double horizontal = 0.0, double vertical = 0.0}) → Widget

Available on Widget, provided by the WidgetsExtension extension

rotate(double scale) → Widget

Available on Widget, provided by the WidgetsExtension extension

rtl() → Widget

Available on Widget, provided by the WidgetsExtension extension

safeArea() → Widget

Available on Widget, provided by the WidgetsExtension extension

scale(double scale) → Widget

Available on Widget, provided by the WidgetsExtension extension

scrollable({Axis scrollDirection = Axis.vertical}) → Widget

Available on Widget, provided by the WidgetsExtension extension

showMenus(List<PopupMenuEntry<int>> items) → Widget

Available on Widget, provided by the WidgetsExtension extension

toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited
translate(Offset offset) → Widget

Available on Widget, provided by the WidgetsExtension extension

Operators

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