Ndef class

NDEF operations on a discovered tag, on either platform.

Acquire one with Ndef.from:

final ndef = Ndef.from(tag);
if (ndef == null) return; // the tag does not hold NDEF

final message = await ndef.read();
if (ndef.isWritable) {
  await ndef.write(NdefMessage([TextRecord.create('merhaba', languageCode: 'tr')]));
}

The platform-only extras live next door: NdefAndroid reports the NFC Forum tag type and whether the tag can be locked, NdefIos re-reads the status live.

Properties

cachedMessage NdefMessage?
The message the tag held at discovery.
final
hashCode int
The hash code for this object.
no setterinherited
isWritable bool
Whether the tag will accept a write.
final
maxSize int
The largest message the tag can hold, in bytes.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read() Future<NdefMessage?>
Reads the message currently on the tag.
toString() String
A string representation of this object.
inherited
write(NdefMessage message) Future<void>
Writes message to the tag.
writeLock() Future<void>
Locks the tag read-only.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

from(NfcTag tag) Ndef?
Returns an instance for tag, or null when the tag does not hold NDEF.