flutter_nfc_kit
Android、iOS、WebでNFC機能を提供し、メタデータの読み取り、NDEFレコードの読み書き、NFCタグ/カードとのレイヤー3およびレイヤー4データのトランセーブを含む
AndroidおよびiOSでのNFC機能を提供するFlutterプラグインで、メタデータの読み取り、NDEFレコードの読み書き、NFCタグ/カードとのレイヤー3およびレイヤー4データの送受信が可能
{"sdk":"flutter"}{"sdk":"flutter"}^4.8.1^0.4.0^3.1.1^1.2.0^1.1.1^1.1.0{"sdk":"flutter"}^6.0.0^2.4.9^6.7.1以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
pub version Test Build Example App
Yet another plugin to provide NFC functionality on Android, iOS and browsers (by WebUSB, see below).
This plugin's functionalities include:
Note that due to API limitations, not all operations are supported on all platforms. You are welcome to submit PRs to add support for any standard-specific operations.
This library uses ndef for NDEF record encoding & decoding.
Please refer to CONTRIBUTING.md for more information.
We have the following minimum version requirements for Android plugin:
jvmTarget in you app's build.gradle)To use this plugin on Android, you also need to:
AndroidManifest.xml.This plugin now supports Swift package manager, and requires iOS 13+.
Info.plist.Info.plist as needed. WARNING: for iOS 14.5 and earlier versions, you MUST add them before invoking poll with readIso18092 or readIso15693 enabled, or your NFC WILL BE TOTALLY UNAVAILABLE BEFORE REBOOT due to a CoreNFC bug.The web version of this plugin does not actually support NFC in browsers, but uses a specific WebUSB protocol, so that Flutter programs can communicate with dual-interface (NFC / USB) devices in a platform-independent way.
Make sure you understand the statement above and the protocol before using this plugin.
We provide simple code example and a example application.
Refer to the documentation for more information.
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.
We provide two operation modes: polling (default) and event streaming. Both can give the same NFCTag object. Please see example for more details.
For Android applications, you can optimize NFC tag detection performance using the androidReaderModeFlags parameter:
// Skip automatic NDEF discovery for ~500ms faster detection
// and disable platform sounds for custom feedback
const flags = 0x80 | 0x100; // FLAG_READER_SKIP_NDEF_CHECK | FLAG_READER_NO_PLATFORM_SOUNDS
final tag = await FlutterNfcKit.poll(
androidReaderModeFlags: flags,
);
Common flags from NfcAdapter:
0x80 - FLAG_READER_SKIP_NDEF_CHECK: Skip automatic NDEF discovery, improving detection speed by ~500ms0x100 - FLAG_READER_NO_PLATFORM_SOUNDS: Disable system beep/vibration for custom audio/haptic feedbackThese flags are particularly useful for applications that: