flutter_nfc_kit
flutter_nfc_kit copied to clipboard
Unable to read/write tags
Hi, i am using mifare ultralight, ndef tag on my android phone (Android Version 12) using the example application provided. Its unable to read/write tag using the example application.
Other apps such as NFC tool is able to read/write the same tag.
Please provide some code to reproduce the problem, and any error log when using flutter_nfc_kit
.
I have NFC tag which has some data in it, but the example application is unable to read or write which is provided by flutter_nfc_kit.
I am running the same example which is present flutter_nfc_kit repo under example folder.
I have NFC tag which has some data in it, but the example application is unable to read or write which is provided by flutter_nfc_kit.
I am running the same example which is present flutter_nfc_kit repo under example folder.
Are you using the write ndef functionality? Please provide some logs so we can look into this problem.
Below are the logs which i am getting while writing,
,0-1080,2295 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController( 9057): show(ime(), fromIme=true)
D/InputMethodManager( 9057): showSoftInput() view=io.flutter.embedding.android.FlutterView{2774a4e VFE...... .F...... 0,0-1080,2295 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController( 9057): show(ime(), fromIme=true)
D/InputMethodManager( 9057): showSoftInput() view=io.flutter.embedding.android.FlutterView{2774a4e VFE...... .F...... 0,0-1080,2295 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController( 9057): show(ime(), fromIme=true)
I/flutter ( 9057): #0 _$NFCTagFromJson (package:flutter_nfc_kit/flutter_nfc_kit.g.dart:47:52)
I/flutter ( 9057): #1 new NFCTag.fromJson (package:flutter_nfc_kit/flutter_nfc_kit.dart:144:57)
I/flutter ( 9057): #2 FlutterNfcKit.poll (package:flutter_nfc_kit/flutter_nfc_kit.dart:261:19)
I/flutter ( 9057): <asynchronous suspension>
I/flutter ( 9057): #3 _MyAppState.build.<anonymous closure> (package:flutter_nfc_kit_example/main.dart:172:44)
I/flutter ( 9057): <asynchronous suspension>
and while reading when i click in start polling , nothing happens
no logs are coming
Seems no tags are polled. Maybe you can just invoke poll
and see if it returns.
Even after invoking poll no logs are printing after this,
NFCTag tag = await FlutterNfcKit.poll();
print('tag'); // this is not printing in console
Sorry but with no further details, we cannot help to diagnose your problem
Hello, I am experiencing the same issue. I am using a Samsung S20FE with Android 13. The tag is an ISO 14443-3A NXP - Mifare Classic 1k
I am just trying to read the tag, because I need the serialnumber from it.
I am using the provided example code in this repo and the latest nfc kit version as of writing this.
After I turned on all exceptions this is the exception I get.
Hello, I am experiencing the same issue. I am using a Samsung S20FE with Android 13. The tag is an ISO 14443-3A NXP - Mifare Classic 1k
I am just trying to read the tag, because I need the serialnumber from it. I am using the provided example code in this repo and the latest nfc kit version as of writing this. After I turned on all exceptions this is the exception I get.
I also got that error.
More details:
#0 _$NFCTagFromJson (package:flutter_nfc_kit/flutter_nfc_kit.g.dart:47:52)
#1 new NFCTag.fromJson (package:flutter_nfc_kit/flutter_nfc_kit.dart:145:57)
#2 FlutterNfcKit.poll (package:flutter_nfc_kit/flutter_nfc_kit.dart:344:19)
<asynchronous suspension>
#3 _MyAppState.build.<anonymous closure> (package:betapper/main.dart:103:48)
<asynchronous suspension>
Looks like 'mifareInfo' value is not a valid json:
{type=ultralight_c, size=176, blockSize=4, blockCount=44, sectorCount=null}
https://github.com/nfcim/flutter_nfc_kit/blob/master/lib/flutter_nfc_kit.g.dart#L47C57-L47C57
So that line throws the error because that can't be converted to that map
demo: https://dartpad.dev/?id=5533bfd8cb4302778488c919cf0c316c
Replacing that with null in the library did it for me and my tags work now, but that's not a good solution :)
Same issue here, updated from version 3.3.1 to 3.4.1 and getting this when tag is picked up:
Unhandled Exception: type 'String' is not a subtype of type 'Map<String, dynamic>' in type cast
#0 _$NFCTagFromJson (package:flutter_nfc_kit/flutter_nfc_kit.g.dart:47:52)
#1 new NFCTag.fromJson (package:flutter_nfc_kit/flutter_nfc_kit.dart:145:57)
#2 FlutterNfcKit.poll (package:flutter_nfc_kit/flutter_nfc_kit.dart:344:19)
Tag type: ISO 14443-3A Device: Pixel 7 - Android 14
This is fixed in v3.4.2.