Menu

Encoding NDEF Records by Hand in Flutter — URIs, Text, vCards and Wi-Fi
📰

Encoding NDEF Records by Hand in Flutter — URIs, Text, vCards and Wi-Fi

DEV Community: dart·Ayesha Iftikhar·18 days ago
#GBAtNI5w
#devtodart#devto#dev#_tlv#ndef
Reading 0:00
15s threshold

Most Flutter NFC tutorials stop at "write a URL". When I built the encoding layer for an NFC app, I needed eleven record types, exact byte counts before writing, and records that every phone would read. Packages like nfc_manager give you the session and the tag; building the right bytes is still up to you.

This post walks through four record types — URI, text, vCard and Wi-Fi — at the byte level, with the Dart I ended up with.

A 30-second NDEF refresher

An NDEF message is a list of records. Each record has:

a TNF (Type Name Format): well-known (NFC Forum types like U and T ), media (a MIME type), external , and so on

a type (e.g. U , or text/vcard )

an optional ID

a payload

With ndef_record / nfc_manager_ndef , building one looks like this:

ndef . NdefRecord ( typeNameFormat: ndef . TypeNameFormat . wellKnown , type: Uint8List .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.