ndef library
NDEF values and the NFC Forum wire codec.
The value types here are pure Dart and need no tag: NdefMessage.toBytes and NdefMessage.fromBytes implement the wire format directly, so a message can be built for host card emulation or parsed out of an Android intent without a session.
The typed record views both build and parse:
final message = NdefMessage([
TextRecord.create('merhaba', languageCode: 'tr'),
UriRecord.create(Uri.parse('https://example.com')),
]);
for (final record in message.records) {
final text = TextRecord.from(record);
if (text != null) print('${text.languageCode}: ${text.text}');
}
Classes
- ExternalRecord
- A record holding application-specific data, namespaced by a domain.
- MimeRecord
- A record holding media data typed by a MIME type, as defined by RFC 2046.
- Ndef
- NDEF operations on a discovered tag, on either platform.
- NdefMessage
- An immutable NDEF message: an ordered list of records.
- NdefRecord
- One immutable NDEF record.
- SmartPosterRecord
- A smart poster: a URI with a human-readable title and an optional action, all packed into one record whose payload is itself an NDEF message.
- TextRecord
- A record holding UTF-8 or UTF-16 text, with the language it is written in.
- UriRecord
- A record holding a URI, stored with its common prefix abbreviated to a single byte.
Enums
- NdefTypeNameFormat
- The NDEF Type-Name-Format, as defined by the NFC Forum NDEF specification.
- SmartPosterAction
- What a reader should do with a smart poster.