from static method

Creates an instance of this class for the given tag.

Returns null if the tag is not compatible.

Implementation

static MifareClassicAndroid? from(NfcTag tag) {
  // ignore: invalid_use_of_protected_member
  final data = tag.data as TagPigeon?;
  final tech = data?.mifareClassic;
  final atag = NfcTagAndroid.from(tag);
  if (data == null || tech == null || atag == null) return null;
  return MifareClassicAndroid._(
    data.handle,
    tag: atag,
    type: MifareClassicTypeAndroid.values.byName(tech.type.name),
    blockCount: tech.blockCount,
    sectorCount: tech.sectorCount,
    size: tech.size,
  );
}