gtin_toolkit 1.0.4 copy "gtin_toolkit: ^1.0.4" to clipboard
gtin_toolkit: ^1.0.4 copied to clipboard

A toolkit for validate, generate and check GTIN's. This project indeeds to be; stable, easy to use and fast (when possible).

example/example.dart

import 'package:gtin_toolkit/gtin_toolkit.dart' as gtinTool;

void main() {
  // Generating a valid GTIN number with 12 digit length
  String validGtin = gtinTool.generateGTIN(gtinLength: 12);
  // make error replacing two right number with 1
  String invalidGtin = validGtin.padRight(10).padRight(13, '1');

  List<int> validGtinArray = validGtin.split('').map(int.parse).toList();
  List<int> invalidGtinArray = invalidGtin.split('').map(int.parse).toList();

  print('Generated GTIN:');
  print(validGtin);
  print('Generated GTIN Type:');
  print(gtinTool.classifyGTIN(validGtin));

  gtinTool.parseAndValidate(validGtin);
  gtinTool.isValidGTIN(validGtinArray);

  gtinTool.parseAndValidate(invalidGtin);
  gtinTool.isValidGTIN(invalidGtinArray);
}
3
likes
150
points
55
downloads

Publisher

unverified uploader

Weekly Downloads

A toolkit for validate, generate and check GTIN's. This project indeeds to be; stable, easy to use and fast (when possible).

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on gtin_toolkit