Search packages, repositories and app categories

Package detailsv4.3.0

nfc_manager

A Flutter plugin providing access to NFC features on Android and iOS.

AndroidiOS
30-day downloads
101K
Likes
532
Pub points
160

Install package

flutter pub add nfc_manager

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

nfc_manager is a Flutter plugin that enables access to NFC (Near Field Communication) functionality on both Android and iOS devices. It allows developers to read and write NFC tags, detect nearby NFC devices, and handle NDEF (NFC Data Exchange Format) messages. The plugin provides a consistent API across platforms, simplifying integration of NFC features into Flutter applications. It supports various NFC operations such as tag detection, reading, writing, and background processing. Ideal for use in contactless payment systems, smart posters, access control, and data sharing apps.

Use cases

  • Reading NFC tags
  • Writing data to NFC tags
  • Implementing contactless payments
  • Creating smart posters
  • Enabling access control systems

Key features

  • Cross-platform NFC support
  • NDEF message handling
  • Tag detection and reading
  • Background NFC scanning
  • Simple API for common NFC tasks

Suitable for

  • Mobile apps requiring NFC interaction
  • Developers building contactless solutions
  • Apps using smart cards or beacons
  • Projects targeting both Android and iOS

Considerations

  • Requires device with NFC hardware
  • Limited iOS NFC capabilities compared to Android
  • Permissions must be granted by the user
  • Not all Android devices support full NFC features

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

nfc_manager

A Flutter plugin providing access to NFC features on Android and iOS.

Setup

Android
iOS

Usage

Handling the Session
import 'package:nfc_manager/nfc_manager.dart';

// Check the availability of NFC on the current device.
NfcAvailability availability = await NfcManager.instance.checkAvailability();

if (availability != NfcAvailability.enabled) {
  print('NFC may not be supported or may be temporarily disabled.');
  return;
}

// Start the session.
NfcManager.instance.startSession(
  pollingOptions: {NfcPollingOption.iso14443}, // You can also specify iso18092 and iso15693.
  onDiscovered: (NfcTag tag) async {
    // Do something with an NfcTag instance...
    print(tag);

    // Stop the session when no longer needed.
    await NfcManager.instance.stopSession();
  },
);
Working with NfcTag

An NfcTag instance is typically not used directly. Instead, convert it to a platform-specific tag class by calling that class's static method from.

import 'package:nfc_manager/nfc_manager.dart';
import 'package:nfc_manager_ndef/nfc_manager_ndef.dart';

final Ndef ndef = Ndef.from(tag);

if (ndef == null) {
  print('This tag is not compatible with NDEF.');
  return;
}

// Do something with an Ndef instance...
print(ndef);

The following platform-specific tag classes are available:

Android only
  • NfcAAndroid
  • NfcBAndroid
  • NfcFAndroid
  • NfcVAndroid
  • IsoDepAndroid
  • MifareClassicAndroid
  • MifareUltralightAndroid
  • NfcBarcodeAndroid
  • NdefAndroid
  • NdefFormatableAndroid
iOS only
  • FeliCaIos
  • MiFareIos
  • Iso15693Ios
  • Iso7816Ios
  • NdefIos
Cross-platform abstractions (separate packages)

Categories

Dependencies

Dependency list 2 items

  • meta^1.17.0
  • ndef_record^1.4.2

Source repository

Projects using this package