我想使用 NFC 显示卡号。但我只能从 nfc 标签获取 uid。 我正在使用 nfc_manager 包 我的代码是这样的:
void _tagRead() {
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
var _tag = tag.data["isodep"]["identifier"]
.map((e) => e.toRadixString(16).padLeft(2, '0'))
.join('');
NfcManager.instance.stopSession();
});
}
不明白我能用这个 ID 做什么?
您可以通过以下方式获取价值
if (_tag.ndef != null && _tag.ndef.isNotEmpty) {
NdefRecord record = _tag.ndef[0].records[0];
String value = String.fromCharCodes(record.payload);
print(value);
}
这将为您提供 NFC 中存储的内容。