sendCommandRaw method

Future<Iso7816ResponseApdu> sendCommandRaw(
  1. Uint8List command
)

Sends an already-encoded command, following any chain it starts.

For a caller that assembles its own APDUs. A 6Cxx retry has to put the corrected Le back in the right place, so the command's shape is read far enough to find its length fields; one that fits none of the four ISO 7816-4 cases throws an ArgumentError rather than being re-sent with a byte appended to whatever it happened to end with.

Throws a StateError when the card asks for more than maxContinuations continuations.

Implementation

Future<Iso7816ResponseApdu> sendCommandRaw(Uint8List command) {
  if (command.length < 4) {
    throw ArgumentError.value(command.length, 'command', 'is shorter than the four-byte APDU header');
  }
  return _chain(command, (length) => _withCorrectedLe(command, length));
}