Convert NfcTag to platform-specific tag classes
mainAn NfcTag instance is a generic container. To interact with specific tag technologies, you must convert it to a platform-specific class using that class's static .from(tag) method. If the tag is not compatible with the requested technology, the method will return null.
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);