nfc_antenna_info_flutter

pub package nfc_antenna_info_flutter coverage style: very good analysis License: BSD-3-Clause

A Flutter plugin for retrieving precise NFC antenna information to accurately locate NFC chips on Android 14 and newer devices.

This plugin is ideal for Flutter developers building apps that depend on accurate NFC interactions—such as contactless payments, access control, or device pairing. By providing detailed NFC antenna location data on supported Android devices (Android 14+), it helps ensure optimal alignment between devices, leading to a smoother user experience and fewer failed NFC reads or connections.

It's especially useful for apps in retail, logistics, IoT, and any domain where NFC precision directly impacts performance.

Features

Provides a straightforward API to gather detailed information about all available NFC antennas on Android devices. It also delivers device-specific details relevant to the positioning of antennas.

Platform support

Android iOS
Support SDK 34+

Requirements

  • Flutter >=3.24.0
  • Dart >=3.5.0
  • Android compileSDK 34
  • Java 17
  • Android Gradle Plugin >=8.2.0
  • Gradle wrapper >=8.3

Public methods

Return Type Method Name Description Throws
Future<NfcAntennaResponse> getNfcAntennaInfo Gets the NFC antenna information. - UnsupportedFeatureException if the platform does not support feature.
- NfcUnavailableException if NFC is not available on the device.
- NfcDisabledException if NFC is disabled on the device.

Parameters of the NfcAntennaResponse:

Type Parameter Name Description
int deviceWidth Width of the device in millimeters.
int deviceHeight Height of the device in millimeters.
bool deviceFoldable Whether the device is foldable.
List<NfcAntenna> availableNfcAntennas All available Nfc Antennas on the device.

Parameters of the NfcAntenna:

Type Parameter Name Description
int locationX Location of the antenna on the X axis in millimeters. 0 is the top-left when the user is facing the screen and the device orientation is Portrait.
int locationY Location of the antenna on the Y axis in millimeters. 0 is the top-left when the user is facing the screen and the device orientation is Portrait.

Example

More examples can be found in /example folder on GitHub.

Feature requests and bugs

Please file feature requests and bugs at the issue tracker.

Maintainers

Libraries

nfc_antenna_info_flutter
A Flutter plugin to get the NFC antenna information on Android. Provided information makes it possible to locate the NFC antenna on the device.