ScanVerdict class final
The answer of a ScannerCheck: its kind and what to tell the user.
ScannerTemplate.checkIn(
check: (barcode) async {
final ticket = await tickets.find(barcode.text);
if (ticket == null) return ScanVerdict.reject(title: 'Invalid ticket');
if (ticket.used) return ScanVerdict.warn(title: ticket.name, message: 'Already checked in');
return ScanVerdict.accept(title: ticket.name, message: ticket.seat);
},
)
The scanner shows the verdict in ScannerTheme.lockColor, ScannerTheme.warningColor or ScannerTheme.dangerColor, with a haptic and a sound of its own for each kind.
- Annotations
Constructors
- ScanVerdict.accept({String? title, String? message, Object? data})
-
Accepts the code.
const
- ScanVerdict.reject({String? title, String? message, Object? data})
-
Refuses the code.
const
- ScanVerdict.warn({String? title, String? message, Object? data})
-
Accepts the code, which needs a look.
const
Properties
- data → Object?
-
What the check found, such as the product your server returned for
the code, for the result sheet:
result.verdict?.datainScannerTemplate.resultBuilderandactionsBuilder. The check is the place for asynchronous work; the builders run synchronously.final - hashCode → int
-
The hash code for this object.
no setteroverride
- kind → ScanVerdictKind
-
The judgement.
final
- message → String?
-
A line under the title, such as a seat.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- title → String?
-
The headline, such as a guest's name or "Invalid ticket";
nullshows the code's text.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