from static method
Creates an instance of this class for the given tag.
Returns null if the tag is not compatible.
Implementation
static NdefAndroid? from(NfcTag tag) {
// ignore: invalid_use_of_protected_member
final data = tag.data as TagPigeon?;
final tech = data?.ndef;
final atag = NfcTagAndroid.from(tag);
if (data == null || tech == null || atag == null) return null;
return NdefAndroid._(
data.handle,
tag: atag,
type: tech.type,
maxSize: tech.maxSize,
canMakeReadOnly: tech.canMakeReadOnly,
isWritable: tech.isWritable,
cachedNdefMessage: tech.cachedNdefMessage == null
? null
: NdefMessage(
records: tech.cachedNdefMessage!.records
.map(
(r) => NdefRecord(
typeNameFormat: TypeNameFormat.values.byName(r.tnf.name),
type: r.type,
identifier: r.id,
payload: r.payload,
),
)
.toList(),
),
);
}