respond method

Future<void> respond(
  1. Uint8List response
)

Answers the APDU most recently delivered to onApduReceived.

The bytes are sent as-is, so include the status word: 9000 for success, 6D00 for an instruction the card does not support.

Only from inside onApduReceived, and only once per APDU. Android gives the emulation service somewhere to send an answer when a command APDU arrives, and takes it away again when the link drops -- so a call made at any other moment has nothing to answer into. Two such moments are ordinary: answering a polling frame delivered to onPollingFrames while observe mode is on, which is not a command and wants no reply, and answering after the reader has left the field.

Such a call does nothing. It does not throw, and the returned future completes normally, because the failure happens on the Android side of the channel after the call has been accepted -- so nothing here can tell you the reader never heard it. The evidence is a warning in logcat under the NfcUtilPlugin tag, which is the only signal there is. Before 3.3.0 the same call crashed the process instead; swallowing it is the price of not doing that.

Implementation

Future<void> respond(Uint8List response) => androidApi.hceRespond(response);