v4.2.1
nfc_manager
Android 및 iOS에서 NFC 기능에 접근할 수 있도록 해주는 플러터 플러그인입니다.
527좋아요 7.7만30일 다운로드160Pub 점수
AndroidiOS
Android 및 iOS에서 NFC 기능에 접근할 수 있도록 해주는 플러터 플러그인입니다.
{"sdk":"flutter"}^1.17.0^1.4.2^6.0.0^26.3.3아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
A Flutter plugin providing access to NFC features on Android and iOS.
AndroidManifest.xml.Info.plist.Info.plist as needed.Info.plist if you specify NfcPollingOption.iso18092 in startSession, otherwise an error will occur.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();
},
);
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:
NfcAAndroidNfcBAndroidNfcFAndroidNfcVAndroidIsoDepAndroidMifareClassicAndroidMifareUltralightAndroidNfcBarcodeAndroidNdefAndroidNdefFormatableAndroidFeliCaIosMiFareIosIso15693IosIso7816IosNdefIosNdef (nfc_manager_ndef)FeliCa (nfc_manager_felica)