To navigate to the Digit Scanner page, use this code snippet:
context.router.push(DigitScannerRoute(
quantity: 1, // Max no. of codes to be scanned
isGS1code: false, // Set Flag to true for scanning GS1 barcode
singleValue: true, // Set Flag to false for scanning multiple codes
));
Wrap the DigitScannerListener or DigitScannerBuilder
Wrap the DigitScannerListener or DigitScannerBuilder in your widget tree wherever you need to read the scanned codes from the scanner state:
BlocListener<DigitScannerBloc, DigitScannerState>(
listener: (context, scannerState) {
if (scannerState.qrCodes.isNotEmpty) {
//
}
},
child: BlocBuilder<DigitScannerBloc, DigitScannerState>(
builder: (context, scannerState) {
if(scannerState.qrCodes.isNotEmpty){
return Text(scannerState.qrCodes.last); ///Get the scanned codes after scanning from the scanner State
}
else {
return Container();}
}
));
Find out about usage at the example implementation.