如何使用nfc_manager读取nfc卡的标识符号
我无法使用 nfc_manager 包读取标识符 nfc 卡。我想我需要解码标签标识符号。我的代码...
'''ValueNotifier<dynamic> result = ValueNotifier(null);'''
void _tagRead() async{
bool isAvailable = await NfcManager.instance.isAvailable();
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
result.value = tag.data;
MifareClassic? nfca = MifareClassic.from(tag);
var read = nfca?.identifier;
}
它返回:标识符[xxx, xx, xxx, xx](四个整数)。
I can´t to read identifier nfc card with nfc_manager package. I think i need decoded the tag identifier number. My code...
'''ValueNotifier<dynamic> result = ValueNotifier(null);'''
void _tagRead() async{
bool isAvailable = await NfcManager.instance.isAvailable();
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
result.value = tag.data;
MifareClassic? nfca = MifareClassic.from(tag);
var read = nfca?.identifier;
}
It´s returning: identifier[xxx, xx, xxx, xx] (four int numbers).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您正在使用
nfc_manager
并且仍然对解决方案感兴趣:鸣谢:https://github.com/okadan/flutter-nfc-manager/issues/89#issuecomment-1170892073
If you are using
nfc_manager
and you are still interested in the solution:Credits: https://github.com/okadan/flutter-nfc-manager/issues/89#issuecomment-1170892073
我使用了 nfc_manager 包,但在项目中也没有得到预期的结果,所以我开始使用 flutter_nfc_kit< /a> 包。只有使用“tag.id”才能访问标识符。
以下是取自 https://github.com/nfcim/flutter_nfc_kit
I used the nfc_manager package and I also didn't get the expected result in my project, so I started using the flutter_nfc_kit package. Only with 'tag.id' has access to the identifier.
Below is a snippet of code taken from the example available at https://github.com/nfcim/flutter_nfc_kit