flutter_nfc_reader 0.0.21

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 83

Flutter NFC Reader

A new flutter plugin to help developers looking to use internal hardware inside iOS or Android devices for reading NFC tags.

The system activate a pooling reading session that stops automatically once a tag has been recognised. You can also trigger the stop event manually using a dedicated function.

How to use

Android setup

Add those two lines to your AndroidManifest.xml on the top

<uses-permission android:name="android.permission.NFC" />
<uses-feature
        android:name="android.hardware.nfc"
        android:required="true" />

and add this in your .MainActivity just below the other intent-filter:

<intent-filter>
  <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <data android:mimeType="text/plain" />
</intent-filter>

Attention the mimeType should be the right one for the expected type of NFC you are going to read.

iOS Setup

Atm only Swift based Flutter project are supported.

  • Enable Capabilities / Near Field Communication Tag Reading.
  • Info.plist file, add Privacy - NFC Scan Usage Description with string value NFC Tag.

Read NFC

This function will return a promise when a read occurs, till that very moment the reading session is open. The promise will return a map with <String, dynamic>. The map will have inside status or data key. In order to stop a reading session you need to use stop function.

Future<void> startNFC() async {
    String response;
    bool reading = true;

    try {
      response = await FlutterNfcReader.read;
    } on PlatformException {
      response = '';
      reading = false;
    }
    setState(() {
      _nfcReading = reading;
      _nfcData = response;
    });
  }

Stop NFC


  Future<void> stopNFC() async {
    bool response;
    try {
      final bool result = await FlutterNfcReader.stop;
      response = result;
    } on PlatformException {
      response = false;
    }
    setState(() {
      _nfcReading = response;
    });
  }

For better details look at the demo app.

Extra

FlutterNfcReader.read() has an optional parameter, only for iOS, called instruction. You can pass a String that contains information to be shown in the modal screen.

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

0.0.14

  • Stable iOS version.
  • Fix issue with importing with Cocoapods.

0.0.5

  • iOS fix support for static modules.

0.0.4

  • iOS add extra details on readme for usage.

0.0.3

  • Flutter required min version is now 0.5.5 as latest stable.

0.0.2

  • Name refactoring for functions, more descriptive and synteic.
  • On read event force stopping the pooling in background to optimize usage.

0.0.1

  • First release, android untested.

example/README.md

flutter_nfc_reader_example

Demonstrates how to use the flutter_nfc_reader plugin.

Getting Started

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_nfc_reader: ^0.0.21

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_nfc_reader/flutter_nfc_reader.dart';
  
Version Uploaded Documentation Archive
0.0.21 Nov 2, 2018 Go to the documentation of flutter_nfc_reader 0.0.21 Download flutter_nfc_reader 0.0.21 archive
0.0.20 Nov 2, 2018 Go to the documentation of flutter_nfc_reader 0.0.20 Download flutter_nfc_reader 0.0.20 archive
0.0.15 Oct 5, 2018 Go to the documentation of flutter_nfc_reader 0.0.15 Download flutter_nfc_reader 0.0.15 archive
0.0.14 Jul 22, 2018 Go to the documentation of flutter_nfc_reader 0.0.14 Download flutter_nfc_reader 0.0.14 archive
0.0.12 Jul 22, 2018 Go to the documentation of flutter_nfc_reader 0.0.12 Download flutter_nfc_reader 0.0.12 archive
0.0.11 Jul 22, 2018 Go to the documentation of flutter_nfc_reader 0.0.11 Download flutter_nfc_reader 0.0.11 archive
0.0.9 Jul 22, 2018 Go to the documentation of flutter_nfc_reader 0.0.9 Download flutter_nfc_reader 0.0.9 archive
0.0.8 Jul 22, 2018 Go to the documentation of flutter_nfc_reader 0.0.8 Download flutter_nfc_reader 0.0.8 archive
0.0.7 Jul 22, 2018 Go to the documentation of flutter_nfc_reader 0.0.7 Download flutter_nfc_reader 0.0.7 archive
0.0.6 Jul 22, 2018 Go to the documentation of flutter_nfc_reader 0.0.6 Download flutter_nfc_reader 0.0.6 archive

All 15 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
76
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7
  • Flutter: 1.0.0

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs (-10 points)

5 out of 5 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8