0 purchases
digit scanner
digit_scanner #
A Scanner package used for scanning QR Codes and GS1 Barcodes.
Getting Started #
To use this package, add the following dependency to your pubspec.yaml file:
dependencies:
digit_scanner: 0.0.0-dev.1
copied to clipboard
Initialize the DigitScannerBloc provider in your application
BlocProvider(
create: (_) {
return DigitScannerBloc(
const DigitScannerState(),
);
},
),
copied to clipboard
To Clear the scanner state
context.read<DigitScannerBloc>().add(
const DigitScannerEvent.handleScanner(),
);
copied to clipboard
Navigating to DigitScanner Page
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 mutiple codes
));
copied to clipboard
Wrap the DigitScannerListener or DigitScannerBuilder in your widget tree wherever you need the Scanned codes.
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();}
}
));
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.