Viewing version 3.0.2. Open the latest package page.

qr

3.0.2

A QR code generation library for Dart and Flutter. Supports QR code version 1 through 40, error correction and redundancy.

Showing cached metadata. Upstream refresh is currently unavailable.

Download archive

Readme

A QR code generation library for Dart and Flutter.

Pub Package package publisher CI

Features

  • Supports QR code versions 1 - 40
  • Error correction / redundancy

Getting started

To start, import the dependency in your code:

import 'package:qr/qr.dart';

To build your QR code data you should do so as such:

final qrCode = QrCode(4, QrErrorCorrectLevel.L)
  ..addData('Hello, world in QR form!');
final qrImage = QrImage(qrCode);

Now you can use your qrImage instance to render a graphical representation of the QR code. A basic implementation would be as such:

for (var x = 0; x < qrImage.moduleCount; x++) {
  for (var y = 0; y < qrImage.moduleCount; y++) {
    if (qrImage.isDark(y, x)) {
      // render a dark square on the canvas
    }
  }
}

See the example directory for further details.

Pre-made UI libraries

The following libraries use qr.dart to generate QR codes for you out of the box:

qr_flutter - A Flutter Widget to render QR codes

barcode - A package that supports many types of scannable codes, include QR.

Demo

A working demo can be found here: kevmoo.github.io/qr.dart

Changelog

3.0.2

  • Require package web: ^1.0.0.
  • Require Dart 3.4 or greater.

3.0.1

  • Fix example in README.md.
  • Require Dart 2.16 or greater.

3.0.0

  • QrImage added to handle image bits.
  • QrCode.make() removed
  • QrCode.isDark() moved to QrImage
  • Added alpha numeric mode support via addAlphaNumeric

2.1.0

  • Added numeric mode support via addNumeric

2.0.0

  • Expose Mask Pattern as a parameter of QrCode.make()
  • Migrated to null safety.
  • Require Dart SDK >=2.12.0 <3.0.0.

1.3.0

  • Added QrCode.addByteData.
  • Added QrCode.fromUint8List.

1.2.1

  • Require Dart SDK >=2.6.0 <3.0.0.

1.2.0

  • Expose InputTooLongException exception so that applications and libraries can check for data length errors.

1.1.1

  • Require Dart SDK >=2.1.0 <3.0.0.
  • Fix a bug that fromData doesn't add supplied data.

1.1.0

  • Add fromData QrCode factory that allows QrCode initiation without providing typeNumber.

1.0.1

  • Support Dart 2 stable.

1.0.0

  • Require at least Dart SDK 2.0.0-dev.17.
  • Fixed a subtle bug with number handling.

0.1.0+2

  • Update README to include basic documentation
  • Update pubspec.yaml description

0.1.0+1

  • Fix author email.

0.1.0

  • Initial release.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'qr:3.0.2'
pubspec.yaml
name: qr
version: 3.0.2
description: >-
  A QR code generation library for Dart and Flutter.
  Supports QR code version 1 through 40, error correction and redundancy.
repository: https://github.com/kevmoo/qr.dart

environment:
  sdk: ^3.4.0

dependencies:
  meta: ^1.7.0

dev_dependencies:
  build_runner: ^2.2.1
  build_web_compilers: ^4.0.8
  dart_flutter_team_lints: ^3.0.0
  stream_transform: ^2.0.0
  test: ^1.21.6
  web: ^1.0.0

Version history

VersionPublishedArchiveSHA-256
0.1.0On demandDownloadeb099925…1b3f1e
0.1.0+1On demandDownload82f2ee26…bd48c5
0.1.0+2On demandDownload1e460447…03a1e4
1.0.0On demandDownload80ebd2ae…10bf7b
1.0.1On demandDownload33e94aae…4ac054
1.1.0On demandDownloadb4838357…d9f966
1.1.1On demandDownloadcacb91bb…a3cd98
1.2.0On demandDownload2bfff54e…468a49
1.3.0On demandDownload0bfe7804…89ab4e
2.0.0-nullsafetyOn demandDownload8b2f9b41…c5f52f
2.0.0-nullsafety.1On demandDownload3a84f3e9…d5966e
2.0.0On demandDownload98ea221b…3d7b5c
2.1.0On demandDownload5c4208b4…128d21
3.0.0On demandDownloaddf93259c…4123f3
3.0.1On demandDownload64957a39…1b64b3
3.0.2Cached · Upstream SHA-256 matchedDownload5a1d2586…3a4445
3.0.3On demandDownload2c0189dc…3b9c8b
4.0.0On demandDownload5adccca7…a759d9
4.0.1On demandDownloadf9461594…e482b6

Dependencies

meta "^1.7.0"