readData method

  1. @override
List<int> readData(
  1. int length
)
override

Implementation

@override
List<int> readData(int length) {
  // generate a list of length + 1 and the first element is
  // `pn532SpiDataRead` and the rest is filled with zeros
  final List<int> frame = [pn532SpiDataRead, ...List.filled(length, 0)];

  sleep(const Duration(milliseconds: 5));

  // transfer the list and read into it at the same time
  final List<int> response = readWriteHelper(frame);

  // get the response of the frame (without the added first byte) and return it
  return response.sublist(1);
}