Skip to content

aBuder/qr.flutter

 
 

Repository files navigation


QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.

Features

  • Built on QR - Dart
  • Supports QR code versions 1 - 40
  • Error correction / redundancy
  • Configurable output size, padding, background and foreground colors
  • Export to image data to save to file or use in memory
  • No internet connection required

Installing

You can install the package by adding the following lines to your pubspec.yaml:

dependencies:
  qr_flutter: ^1.1.6

Note: If you're using the Flutter master channel (or you encounter build issues) then you should use the 2.0.0-dev branch and not a specific release version. To do so, use the following configuration in your pubspec.yaml:

dependencies:
  qr_flutter:
    git:
      url: git://github.com/lukef/qr.flutter.git
      ref: 2.0.0-dev

Keep in mind the 2.0.0-dev branch could be unstable. You can also pin to a specific dev tag such as 2.0.0-dev.1.

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:qr_flutter/qr_flutter.dart';

Next, to render a basic QR code you can use the following code (or something like it):

new QrImage(
  data: "1234567890",
  size: 200.0,
),

Depending on your data requirements you may want to tweak the QR code output. The following options are available:

Property Type Description
version int A value between 1 and 40. See http://www.qrcode.com/en/about/version.html for details.
errorCorrectionLevel int A value defined on QrErrorCorrectLevel. e.g.: QrErrorCorrectLevel.L.
size double The (square) size of the image. If not given, will auto size using shortest size constraint.
padding EdgeInsets Padding surrounding the QR code data
backgroundColor Color The background color (default is none)
foregroundColor Color The foreground color (default is black)
gapless bool Adds an extra pixel in size to prevent gaps

Example

See the example directory for a basic working example.

FAQ

Has it been tested in production? Can I use it in production?

Yep! It's stable and ready to rock. It's currently in use in quite a few production applications including:

Outro

Credits

Thanks to Kevin Moore for his awesome QR - Dart library. It's the core of this library.

For author/contributor information, see the AUTHORS file.

License

QR.Flutter is released under a modified MIT license. See LICENSE for details.

About

QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 89.5%
  • Objective-C 7.1%
  • Java 3.4%