I'm trying to create a record to write to an NFC tag/reader using FlutterNfcKit.writeNDEFRecords.
My code is as follows:
NDEFRecord record = NDEFRecord(
type: NDEFTypeNameFormat.nfcWellKnown,
typeName: "debit_card",
payload: cardDetails.codeUnits,
);
FlutterNfcKit.writeNDEFRecords([record]);
FlutterNfcKit.finish(iosAlertMessage: "Hold your device near an NFC reader to write the virtual debit card.");
However, i'm getting an error with the correct syntax for 'record'. Please help.
I've tried modifying the parameters of NDEF record but I'm still getting an error. What I want is to create a record with a type of debit_card and a payload of cardDetails.codeUnits
Ndef data format is not off the shelf really designed to store debit card details.
It is more designed to store Text, URL's but it does have custom mime type records, where you could create your own data format to store debit card details.
I suggest you read the Ndef spec documents at https://github.com/haldean/ndef/tree/master/docs it has detail of the "Well Known" types.
So as "debit_card" is not defined as a well known type I suggest you create a custom mime type record
I'm note aware of any mime Types for debit card details (only things like Bluetooth pairing and Wifi details)
I'm not a flutter expert but it does seem to have a Mime Record class
https://pub.dev/documentation/ndef/latest/record_mime/MimeRecord-class.html
Then just pick you own mime Type String (some like "application/debit_card") and give it the hex payload data you want to store.