Skip to content

kevmoo/qr.dart

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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