flutter_nfc_kit 1.0.0

Flutter NFC Kit #

pub version

Yet another plugin to provide NFC functionality on Android and iOS.

This plugin supports:

  • read metadata of tags / cards complying with:
    • ISO 14443-4 Type A & Type B (NFC-A / NFC-B / Mifare Classic / Mifare Plus / Mifare Ultralight / Mifare Desfire)
    • ISO 18092 (NFC-F / Felica)
    • ISO 15963 (NFC-V)
  • transceive commands with tags / cards complying with:
    • ISO 7816 Smart Cards (layer 4, in APDUs)
    • other device-supported technologies (layer 3, in raw commands, Android only)

Note that due to API limitations not all operations are supported on both platforms.

Setup #

Thank nfc_manager plugin for these instructions.

Android #

iOS #

Usage #

Simple example:

import 'package:flutter_nfc_kit/flutter_nfc_kit.dart';

var availability = await FlutterNfcKit.nfcAvailability;
if (availability != NFCAvailability.available) {
    // oh-no
}

var tag = await FlutterNfcKit.poll();
print(jsonEncode(tag));
if (tag.type == NFCTagType.iso7816) {
    var result = await FlutterNfcKit.transceive("00B0950000");
    print(result);
}
await FlutterNfcKit.finish();

A more complicated example can be seen in example dir.

Refer to the documentation for more information.

Error codes #

We use error codes with similar meaning as HTTP status code. Brief explanation and error cause in string (if available) will also be returned when an error occurs.

0.0.1 #

  • Initial release
  • Support reading metadata of cards of standard ISO 14443-4 Type A & Type B (NFC-A / NFC-B / Mifare Classic / Mifare Ultralight)
  • Support transceiving APDU with cards of standard ISO 7816

0.0.2 #

  • Support reading metadata of cards of standard ISO 18092 / JIS 6319 (NFC-F / Felica)
  • Support reading metadata of cards of standard ISO 15963 (NFC-V)
  • Support reading GUID of China ID Card (which is non-standard)
  • Add more documentation
  • Release with MIT License

0.0.3 #

  • Fix compilation errors of iOS plugin

0.0.4 #

  • Fix IsoDep unintentionally closing of the Android plugin
  • Fix incorrect standards description

0.0.5 #

  • Fix finish method blocking error

0.0.6 #

  • Avoid returning redundant result if user finish the read operation prematurely

0.0.7 #

  • Allow data transceive on lower layer (Android only)

1.0.0 #

  • Remove China ID Card support due to support of lower layer transceiving
  • Fix some racing problem on iOS
  • We are out-of beta and releasing on time!

example/README.md

Example of flutter_nfc_kit #

We provide both Android and iOS examples in this project.

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_nfc_kit: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub 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_kit/flutter_nfc_kit.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
60
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
80
Learn more about scoring.

We analyzed this package on Feb 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health suggestions

Format lib/flutter_nfc_kit.dart.

Run flutter format to format lib/flutter_nfc_kit.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
json_annotation ^3.0.1 3.0.1
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
build_runner ^1.7.3
flutter_test
json_serializable ^3.2.5