barcode_cleaner 1.0.1
barcode_cleaner: ^1.0.1 copied to clipboard
A Flutter package for cleaning and formatting barcodes with various options including removing leading zeros, limiting length, and filtering characters.
Barcode Cleaner #
A Flutter package for cleaning and formatting barcodes with various options.
Features #
- Remove leading zeros
- Limit barcode length
- Clean barcodes with various options:
- Only numbers
- Alphanumeric and ASCII characters
- Symbols and ASCII characters
- Custom cleaning options for different character sets
Installation #
Add the following to your pubspec.yaml file:
dependencies:
barcode_cleaner: <LATEST_VERSION>
Usage #
import 'package:barcode_cleaner/barcode_cleaner.dart';
void main() {
final barcodeCleaner = BarcodeCleaner();
// Remove leading zeros
final cleanedBarcode = barcodeCleaner.removeStartZero('00012345');
print(cleanedBarcode); // '12345'
// Limit barcode length
final limitedBarcode = barcodeCleaner.removeIncreasedLetter('123456789', 5);
print(limitedBarcode); // '12345'
// Clean barcode with basic options
final basicCleaned = barcodeCleaner.clean(
barcode: 'ABC123!@#',
cleanBarCodeOption: CleanBarCodeOption.onlyNumbers,
);
print(basicCleaned); // '123'
// Clean barcode with custom options
final customCleaned = barcodeCleaner.customClean(
barcode: 'ABC123!@#',
customCleanOption: CustomCleanOption.enCharSmallAndBigPlusNumbers,
);
print(customCleaned); // 'ABC123'
}
Available Cleaning Options #
Basic Cleaning Options #
none: No cleaningonlyNumbers: Keep only numbersalphaNumericAndAsciiCharOnly: Keep alphanumeric and ASCII charactersonlySymbolsAndAsciiChar: Keep symbols and ASCII characters
Custom Cleaning Options #
onlyNumbers: Keep only numbersenCharSmallAndBig: Keep English characters (both cases)enCharSmallAndBigPlusNumbers: Keep English characters and numbersenCharBig: Keep only uppercase English charactersenCharBigPlusNumbers: Keep uppercase English characters and numbersenCharSmall: Keep only lowercase English charactersenCharSmallPlusNumbers: Keep lowercase English characters and numbersarChar: Keep only Arabic charactersarCharPlusNumbers: Keep Arabic characters and numbersarCharAndEnCharBigAndSmall: Keep Arabic and English charactersarCharAndEnCharBigAndSmallPlusNumbers: Keep Arabic, English characters, and numbers
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
License #
MIT License
Support #
If you encounter any issues or have questions, please file an issue on the GitHub repository.