ndef library
A Dart library to decode & encode NDEF records.
This library supports multiple types of NDEF (NFC Data Exchange Format) records including well-known, media, absolute URI, and external records.
Use decodeRawNdefMessage to decode raw NDEF messages from byte arrays, decodePartialNdefMessage to decode individual records with separate parts, and encodeNdefMessage to encode NDEF messages to byte arrays.
Classes
- AARRecord
- Android Application Record (AAR) for launching Android apps via NFC.
- AbsoluteUriRecord
- A NDEF record with absolute URI type.
- ActionRecord
- A NDEF record indicating the suggested action for a Smart Poster.
- AlternativeCarrierRecord
- A NDEF record describing an alternative carrier for connection handover.
- BluetoothEasyPairingRecord
- A NDEF record for Bluetooth Easy Pairing (Secure Simple Pairing).
- BluetoothLowEnergyRecord
- A NDEF record for Bluetooth Low Energy out-of-band pairing.
- BluetoothRecord
- Base class for Bluetooth NDEF records.
- CollisionResolutionRecord
- A NDEF record containing a 16-bit random number for collision resolution.
- DataElement
- A data element in a Device Information record.
- DeviceClass
- DeviceInformationRecord
- A NDEF record containing device information.
- EIR
- EPAddress
- Bluetooth Easy Pairing address.
- ErrorRecord
- A NDEF record describing an error in connection handover.
- ExternalRecord
- A NDEF record with NFC Forum external type.
- HandoverCarrierRecord
- HandoverInitiateRecord
- HandoverMediationRecord
- HandoverRecord
- Base class for connection handover NDEF records.
- HandoverRequestRecord
- A NDEF record for initiating connection handover.
- HandoverSelectRecord
- LEAddress
- Bluetooth Low Energy address with type.
- MimeRecord
- A NDEF record with MIME media type (RFC 2046).
- NDEFRecord
- The base class of all types of records. Also represents an record of unknown type.
- NDEFRecordFlags
- Represent the flags in the header of a NDEF record.
- ServiceClass
- SignatureRecord
- A NDEF Signature Record used to protect the integrity and authenticity of NDEF Messages.
- SizeRecord
- A NDEF record indicating the size of the referenced object.
- SmartPosterRecord
- A NDEF Smart Poster record containing rich metadata about a URI.
- TextRecord
- A NDEF record containing text with language code.
- TypeRecord
- A NDEF record indicating the MIME type of the referenced object.
- UriRecord
- A NDEF record containing a URI (Uniform Resource Identifier).
- WellKnownRecord
- A NDEF record with NFC Forum well-known type.
- WifiRecord
- A NDEF record for WiFi network configuration (WiFi Simple Configuration).
Enums
- Action
- Actions that can be performed on a Smart Poster.
- CarrierPowerState
- Power state of a carrier in connection handover.
- EIRType
- ErrorReason
- LEAddressType
- Bluetooth Low Energy address type.
- TextEncoding
- Text encoding types supported by TextRecord.
- TypeNameFormat
- The TNF (Type Name Format) field of a NDEF record.
- WifiAuthenticationType
- WiFi authentication types according to WSC specification.
- WifiEncryptionType
- WiFi encryption types according to WSC specification.
Functions
-
decodePartialNdefMessage(
TypeNameFormat tnf, Uint8List type, Uint8List payload, {Uint8List? id}) → NDEFRecord - Decode a NDEF record, providing its parts separately. This is most useful in mobile environment because the APIs will give you these information in a separate manner.
-
decodeRawNdefMessage(
Uint8List data, {dynamic typeFactory = NDEFRecord.defaultTypeFactory}) → List< NDEFRecord> - Decode raw NDEF messages (containing at least one NDEFRecord) from byte array
-
encodeNdefMessage(
List< NDEFRecord> records, {bool canonicalize = true}) → Uint8List -
Encode an NDEF message (containing several NDEFRecords) to byte array.
Set
canonicalizeto set the MB and ME fields automatically in the first / last record.
Typedefs
- TypeFactory = NDEFRecord Function(TypeNameFormat tnf, String classType)
-
Construct an instance of a specific type (subclass) of NDEFRecord according to
tnfandclassType