from static method
Reads record as an external record, or returns null when it is not one or carries no
domain:type separator.
Implementation
static ExternalRecord? from(NdefRecord record) {
if (record.typeNameFormat != NdefTypeNameFormat.external) return null;
final combined = utf8.decode(record.type, allowMalformed: true);
final separator = combined.indexOf(':');
if (separator <= 0 || separator == combined.length - 1) return null;
return ExternalRecord._(
domain: combined.substring(0, separator),
type: combined.substring(separator + 1),
data: record.payload,
);
}