Saturday 6 July 2019

A Flutter library for simple and fast Barcode rendering via custom painter

flutter tutorial,flutter,flutter tutorial for beginners,flutter app,flutter tutorials,flutter sdk,tutorial,flutter course,learn flutter,flutter tutorial ios,flutter firebase tutorial,flutter widgets,flutter app development tutorial,flutter ios,flutter dart,flutter android,google flutter,flutter sdk tutorial,flutter tutorial app,google flutter tutorial,flutter sqflite tutorial,flutter tutorial deutsch,flutter tutorial android

barcode generate library for Flutter

Barcode Flutter is a Flutter library for simple and fast Barcode rendering via custom painter.
flutter tutorial,flutter,flutter tutorial for beginners,flutter app,flutter tutorials,flutter sdk,tutorial,flutter course,learn flutter,flutter tutorial ios,flutter firebase tutorial,flutter widgets,flutter app development tutorial,flutter ios,flutter dart,flutter android,google flutter,flutter sdk tutorial,flutter tutorial app,google flutter tutorial,flutter sqflite tutorial,flutter tutorial deutsch,flutter tutorial android

Features

  • Supports code type: Code39Code93Code128EAN13EAN8UPCAUPCE
  • Supports render with or without text label
  • Supports adjusting the bar width
  • No internet connection required

Installing

You can install the package by adding the following lines to your pubspec.yaml:
dependencies:
    barcode_flutter: ^1.0.0
YAML
After adding the dependency to your pubspec.yaml you can run: flutter packages get or update your packages using your IDE.

Getting started

To start, import the dependency in your code:
import 'package:barcode_flutter/barcode_flutter.dart';
Dart
Next, to reander a Barcode (Code39 for example), you can use the following code:
new BarCodeImage(
  data: "1234ABCD",              // Code string. (required)
  codeType: BarCodeType.Code39,  // Code type (required)
  lineWidth: 2.0,                // width for a single black/white bar (default: 2.0)
  barHeight: 90.0,               // height for the entire widget (default: 100.0)
  hasText: true,                 // Render with text label or not (default: false)
  onError: (error) {             // Error handler
    print('error = $error');
  },
);
Dart
NOTE: You can only tweak the lineWidth parameter to change the entire widget's width. But value less than 2.0 will sometimes make the barcode scaner more difficult to recognize result correctly. 2.0 is a safe value for all code types.
Error handling: You have to make sure the code strings provided are valid. If you are not sure about the data, maybe it comes from
user input or something, then setup onError method, and put your error handling logic there. Sometimes the library will render parts of
the barcode if the data is invalid, and if that happens, I can't guarantee that the result can be recognized by a barcode scaner.


GitHub

barcode generate library for Flutter — Read More
Latest commit to the master branch on 4-23-2019
Download as zip