getAntennaInfo method

Future<NfcAntennaInfo?> getAntennaInfo()

Where this device's NFC antennas are, or null when the platform does not say.

Null below API 34, and on a device that reports no geometry -- which is most of them. Treat a non-null answer as a bonus for the "hold your tag here" hint, not something to build a screen around.

Implementation

Future<NfcAntennaInfo?> getAntennaInfo() async {
  final info = await androidApi.getAntennaInfo();
  if (info == null) return null;
  return NfcAntennaInfo(
    deviceWidth: info.deviceWidth,
    deviceHeight: info.deviceHeight,
    deviceFoldable: info.deviceFoldable,
    antennas: [
      for (final antenna in info.availableNfcAntennas) NfcAntennaLocation(x: antenna.locationX, y: antenna.locationY),
    ],
  );
}