FakeTech.ndefAndroid constructor

FakeTech.ndefAndroid({
  1. String type = 'org.nfcforum.ndef.type2',
  2. int maxSize = _ndefCapacity,
  3. bool isWritable = true,
  4. bool canMakeReadOnly = true,
  5. NdefMessage? cachedMessage,
})

android.nfc.tech.Ndef, which carries both Ndef and NdefAndroid.

cachedMessage is the way to hand a test a message without overriding a host API call: it arrives as Ndef.from(tag)?.cachedMessage, the same snapshot a real discovery takes.

Implementation

factory FakeTech.ndefAndroid({
  String type = 'org.nfcforum.ndef.type2',
  int maxSize = _ndefCapacity,
  bool isWritable = true,
  bool canMakeReadOnly = true,
  NdefMessage? cachedMessage,
}) => FakeTech._(
  'Ndef',
  (data) => data.ndefAndroid = NdefAndroidPigeon(
    type: type,
    maxSize: maxSize,
    isWritable: isWritable,
    canMakeReadOnly: canMakeReadOnly,
    cachedMessage: cachedMessage == null ? null : ndefMessageToWire(cachedMessage),
  ),
);