MobileScanner class

The MobileScanner widget displays a live camera preview.

Inheritance

Constructors

MobileScanner({MobileScannerController? controller, MobileScannerErrorBuilder? errorBuilder, BoxFit fit = BoxFit.cover, required void onDetect(BarcodeCapture barcodes), @Deprecated('Use onScannerStarted() instead.') void onStart(MobileScannerArguments? arguments)?, void onScannerStarted(MobileScannerArguments? arguments)?, Widget placeholderBuilder(BuildContext, Widget?)?, Rect? scanWindow, bool startDelay = false, Widget? overlay, Key? key})
Create a new MobileScanner using the provided controller and onBarcodeDetected callback.
const

Properties

controller MobileScannerController?
The controller that manages the barcode scanner.
final
errorBuilder MobileScannerErrorBuilder?
The function that builds an error widget when the scanner could not be started.
final
fit BoxFit
The BoxFit for the camera preview.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onDetect → void Function(BarcodeCapture barcodes)
The function that signals when new codes were detected by the controller.
final
onScannerStarted → (void Function(MobileScannerArguments? arguments)?)
The function that signals when the barcode scanner is started.
final
onStart → (void Function(MobileScannerArguments? arguments)?)
The function that signals when the barcode scanner is started.
final
overlay Widget?
The overlay which will be painted above the scanner when has started successful. Will no be pointed when an error occurs or the scanner hasn't been started yet.
final
placeholderBuilder → (Widget Function(BuildContext, Widget?)?)
The function that builds a placeholder widget when the scanner is not yet displaying its camera preview.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scanWindow Rect?
if set barcodes will only be scanned if they fall within this Rect useful for having a cut-out overlay for example. these Rect coordinates are relative to the widget size, so by how much your rectangle overlays the actual image can depend on things like the BoxFit
final
startDelay bool
Only set this to true if you are starting another instance of mobile_scanner right after disposing the first one, like in a PageView.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<MobileScanner>
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
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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}) 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

Operators

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