ef_qrcode

pub package

A flutter plugin can be used to generate QRCode.

Example

Getting Started

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use

Android

This pub need WRITE_EXTERNAL_STORAGE permission, so add this to AndroidManifest.xml in your project first:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:remove="android:maxSdkVersion"/>

And do not forget to request permissions before use with some approaches like checkSelfPermission or shouldShowRequestPermissionRationale.

iOS

Nothing.

Flutter

  1. Dependency

In your pubspec.yaml, add the following config:

dependencies:
   ef_qrcode: 0.2.1
  1. Generate

The method statement is as follows:

static Future<File> generate(String content, String backgroundColor, String foregroundColor)

You can call this method liek this:

void generateImage() async {
   try {
      var imageFile = await EfQrcode.generate("content", "#ffffff", "#000000");
      setState(() {
         _imageFile = imageFile;
      });
   }
   catch (e) {
      print(e);
   }
}

For more information, you can see the example project.

Author

EyreFree, eyrefree@eyrefree.org

Libraries

ef_qrcode