barcode_image 1.0.2

barcode_image #

Barcode generation library for Dart that can generate barcodes using the pub:image library.

Dart usage #

// Create an image
final image = Image(300, 120);

// Fill it with a solid color (white)
fill(image, getColor(255, 255, 255));

// Draw the barcode
drawBarcode(image, Barcode.code128(), 'Test', font: arial_24);

// Save the image
File('test.png').writeAsBytesSync(encodePng(image));
Barcode

Command line usage #

Install the barcode command

pub global activate barcode_image

run it

barcode

or

pub run barcode_image:barcode

Changelog #

1.0.2 #

  • Fix text placement
  • Fix bar dimensions

1.0.1 #

  • Add missing dependency
  • Update command line barcode generator

1.0.0 #

  • Initial release.

example/main.dart

// ignore_for_file: always_specify_types

import 'dart:io';

import 'package:barcode_image/barcode_image.dart';
import 'package:image/image.dart';

void main() {
  // Create an image
  final image = Image(600, 350);

  // Fill it with a solid color (white)
  fill(image, getColor(255, 255, 255));

  // Draw the barcode
  drawBarcode(image, Barcode.code128(), 'Test', font: arial_24);

  // Save the image
  File('barcode.png').writeAsBytesSync(encodePng(image));
}

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate barcode_image

2. Use it

The package has the following executables:


$ barcode

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  barcode_image: ^1.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:barcode_image/barcode_image.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
7
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

We analyzed this package on Feb 12, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
args ^1.5.0 1.5.2
barcode ^1.3.0 1.5.0
image ^2.1.0 2.1.12
meta ^1.1.5 1.1.8
Transitive dependencies
archive 2.0.13
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
path 1.6.4
petitparser 3.0.1
typed_data 1.1.6
xml 3.7.0
Dev dependencies
pedantic 1.9.0