Dart/Flutter library for encoding and decoding OpenPrintTag data on NFC tags. Based on the Python OpenPrintTag library.
dependencies:
open_print_tag: ^0.1.0import 'package:open_print_tag/open_print_tag.dart';
// Create parser
final parser = OpenPrintTagParser.create();
// Write data
final payload = OpenPrintTagPayload(
data: OpenPrintTagData(
main: OpenPrintTagMainData(
materialClass: MaterialClassEnum.FFF,
materialType: MaterialTypeEnum.PLA,
materialName: 'My PLA',
minPrintTemperature: 200,
minBedTemperature: 60,
),
),
);
final encoded = parser.encode(payload, size: 320); // 320 bytes for NTAG213
// Read data
final decoded = await parser.decode(encoded);
print('Material: ${decoded.data.main?.materialName}');The library handles OpenPrintTag CBOR encoding. You'll need an NDEF library to actually read/write NFC tags.
MIME type: application/vnd.openprinttag (available as OpenPrintTagConstants.mimeType)
This library uses a Git submodule to track data definitions (field schemas, enums) from the upstream OpenPrintTag repository.
To update to the latest definitions:
make update-data- OpenPrintTag (Python) - Original implementation
- Specification - Format docs
- Repository
MIT