BarcodeReader class final
Reads barcodes from images: photos, files, screenshots, raw pixels.
Decoding runs in the background (an isolate on native platforms, a Web Worker on the web) and never blocks the UI. There is nothing to create or dispose: a reader is a constant configuration, the engine starts on first use.
const reader = BarcodeReader();
final barcode = await reader.read(await file.readAsBytes());
const qr = BarcodeReader(formats: {BarcodeFormat.qrCode});
final all = await qr.readAll(bytes);
- Annotations
Constructors
-
BarcodeReader({Set<
BarcodeFormat> ? formats, ReaderOptions options = const ReaderOptions()}) -
Creates a reader.
const
Properties
-
formats
→ Set<
BarcodeFormat> ? -
Formats to look for;
nullmeans all. Fewer formats read faster. A base symbology includes its variants, see BarcodeFormat.final - hashCode → int
-
The hash code for this object.
no setteroverride
- options → ReaderOptions
-
Search strategies.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{Set< BarcodeFormat> ? formats, ReaderOptions? options}) → BarcodeReader - Creates a copy with the given fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
Uint8List encodedImage) → Future< Barcode?> - Finds the first barcode in an encoded image (JPEG, PNG, GIF, BMP; on the web also anything the browser decodes, such as WebP and AVIF).
-
readAll(
Uint8List encodedImage, {int? limit}) → Future< List< Barcode> > -
Finds every barcode in an encoded image, up to
limitif given. -
readAllPixels(
PixelBuffer image, {int? limit}) → Future< List< Barcode> > -
Finds every barcode in raw pixels, up to
limitif given. -
readPixels(
PixelBuffer image) → Future< Barcode?> -
Finds the first barcode in raw pixels. Returns
nullif there is none. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override