BarcodeView class

Shows a barcode. Drawn as vectors from the module matrix, so it is sharp at any size and pixel density.

BarcodeView('https://pub.dev', format: BarcodeFormat.qrCode, width: 200)
BarcodeView('4006381333931', format: BarcodeFormat.ean13, showText: true, width: 240)
BarcodeView.bytes(payload, format: BarcodeFormat.dataMatrix, width: 120)

Without width and height it fills the incoming constraints, keeping the symbol's aspect ratio.

Inheritance

Constructors

BarcodeView(String data, {Key? key, BarcodeFormat format = BarcodeFormat.qrCode, ErrorCorrection? errorCorrection, bool showText = false, BarcodeStyle style = BarcodeStyle.classic, double? width, double? height, String? semanticLabel, Widget errorBuilder(BuildContext context, BarcodeWriteException error)?})
Creates a barcode view for the text data.
const
BarcodeView.bytes(Uint8List bytes, {Key? key, BarcodeFormat format = BarcodeFormat.qrCode, ErrorCorrection? errorCorrection, BarcodeStyle style = BarcodeStyle.classic, double? width, double? height, String? semanticLabel, Widget errorBuilder(BuildContext context, BarcodeWriteException error)?})
Creates a barcode view for binary bytes (formats with a byte mode: QR, Data Matrix, Aztec, PDF417).
const
BarcodeView.symbol(BarcodeSymbol symbol, {Key? key, BarcodeStyle style = BarcodeStyle.classic, double? width, double? height, String? semanticLabel})
Draws a BarcodeSymbol as it is: the modules a reader sampled from a code (Barcode.symbol), or a symbol from BarcodeWriter.encode. Nothing is encoded, so the code shown is exactly the one read.

Properties

bytes → Uint8List?
The binary data to encode, or null for text.
final
data → String?
The text to encode, or null for BarcodeView.bytes.
final
errorBuilder → Widget Function(BuildContext context, BarcodeWriteException error)?
Shown instead of the barcode if data cannot be encoded. Without it, an empty box is shown and the error is reported to FlutterError.
final
errorCorrection → ErrorCorrection?
Error correction; null uses the format's default, or ErrorCorrection.high for a QR code with a BarcodeStyle.logo.
final
format → BarcodeFormat
The symbology; must be writable (BarcodeFormat.canWrite).
final
hashCode → int
The hash code for this object.
no setterinherited
height → double?
Height in logical pixels.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → String?
Accessibility label; defaults to "format barcode: data".
final
showText → bool
Show the human readable text under linear barcodes.
final
style → BarcodeStyle
Colors and shapes.
final
symbol → BarcodeSymbol?
The symbol to draw as it is, from BarcodeView.symbol.
final
width → double?
Width in logical pixels.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<BarcodeView>
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, 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

Operators

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