Barcode class final
A barcode found in an image or a camera frame.
final barcode = await const BarcodeReader().read(bytes);
if (barcode != null) print('${barcode.format.displayName}: ${barcode.text}');
- Available extensions
- Annotations
Constructors
- Barcode({required BarcodeFormat format, required String text, required Uint8List bytes, required BarcodePosition position, BarcodeContentType contentType = BarcodeContentType.text, int rotation = 0, bool isMirrored = false, bool isInverted = false, String? ecLevel, String? version, String symbologyIdentifier = '', BarcodeSequence? sequence, BarcodeError? error, BarcodeSymbol? symbol})
-
Creates a barcode. Results come from the engine; the constructor is
public so tests and fakes can build them.
const
Properties
- bytes → Uint8List
-
The raw payload bytes, before any character set interpretation.
final
- content → BarcodeContent
-
Available on Barcode, provided by the BarcodeContentOf extension
The payload parsed into a typed value: a URL, a Wi-Fi network, a contact, GS1 data and so on. Falls back to TextContent or BinaryContent. Parsed once per barcode.no setter - contentType → BarcodeContentType
-
How to interpret the payload.
final
- ecLevel → String?
-
Error correction level, if the symbology has one, in its own terms:
final
- error → BarcodeError?
-
Why the barcode could not be decoded, or
nullif it was. Only barcodes read with ReaderOptions.returnErrors can have an error.final - format → BarcodeFormat
-
The symbology, as specific as known (e.g. BarcodeFormat.ean13).
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isInverted → bool
-
Whether the symbol was found with inverted colors (light on dark).
final
- isMirrored → bool
-
Whether the symbol was found mirrored.
final
- isValid → bool
-
Whether the barcode was decoded successfully.
no setter
- position → BarcodePosition
-
Where the barcode is, in pixels of the source image.
final
- rotation → int
-
Clockwise rotation of the symbol in degrees, from -180 to 180: a
symbol turned a quarter counterclockwise is at -90, not 270.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sequence → BarcodeSequence?
-
Structured append: the part of a multi-symbol message this barcode is,
or
nullif it stands alone.final - symbol → BarcodeSymbol?
-
The grid of modules the reader sampled from a matrix code (QR, Micro
QR, rMQR, Data Matrix, Aztec, MaxiCode), exactly as read: a damaged
module shows as it was read.
nullfor codes read by their bar widths (linear codes, PDF417) and for barcodes not read by the engine.final - symbologyIdentifier → String
-
ISO/IEC 15424 symbology identifier, e.g.
]Q1.final - text → String
-
The payload as text (UTF-8, or decoded with the character set the
barcode declares). For GS1 codes this is the human readable form,
e.g.
(01)09501101530003(17)250101.final - version → String?
-
Symbol version, if the symbology has one:
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override