QrBarScanResult class
A model class that represents the result of a successful barcode or QR code scan.
This class encapsulates all information from a scanned code, including the raw data value, the detected format type, and the timestamp when the scan occurred. It provides a standardized structure for handling scan results throughout the application.
Typically obtained from the onScan callback of QrBarScanView:
QrBarScanView(
onScan: (QrBarScanResult result) {
// Process the scan result
print('Scanned a ${result.type.label}: ${result.value}');
// Check the scan type and handle accordingly
if (result.type == QrBarType.qr) {
// Handle QR code data
handleQrCodeData(result.value);
} else if (result.type == QrBarType.ean13) {
// Handle product barcode
lookupProduct(result.value);
}
},
)
The class also provides a useful toString implementation for debugging and logging purposes.
Constructors
- QrBarScanResult({required String value, required QrBarType type, DateTime? time})
- Creates a new scan result containing the scanned value and type.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- time → DateTime
-
The timestamp when the code was scanned.
final
- type → QrBarType
-
The format/type of the scanned code (e.g., QR, Code128, etc.).
final
- value → String
-
The raw string value extracted from the scanned code.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
Returns a string representation of the scan result.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited