from static method

NfcBarcode? from(
  1. NfcTag tag
)

Returns an instance for tag, or null when the tag is not a barcode tag.

Implementation

static NfcBarcode? from(NfcTag tag) {
  final data = tag.data.nfcBarcode;
  if (data == null) return null;
  return NfcBarcode._(
    type: switch (data.type) {
      NfcBarcodeTypePigeon.kovio => NfcBarcodeType.kovio,
      NfcBarcodeTypePigeon.unknown => NfcBarcodeType.unknown,
    },
    barcode: data.barcode,
  );
}