removeStartZero method

String removeStartZero(
  1. String barcode
)

Removes leading zeros from the barcode.

This method removes all consecutive zeros at the beginning of the barcode. If the barcode contains only zeros, an empty string is returned.

Example:

final cleaner = BarcodeCleaner();
final result = cleaner.removeStartZero('00012345'); // Returns '12345'

Implementation

String removeStartZero(String barcode) {
  return barcode.replaceFirst(RegExp(r'^0+'), '');
}