fromBytes static method
Implementation
static CAAResponseRecord fromBytes({
required String name,
required int ttl,
required Uint8List bytes,
required int offset,
required int length }) {
if (length < 2) {
throw FormatException('Invalid CAA record: too short');
}
final int flags = bytes[offset];
final int tagLength = bytes[offset + 1];
if (length < 2 + tagLength) {
throw FormatException('Invalid CAA record: tagLength overflow');
}
final String tag = String.fromCharCodes(bytes.sublist(offset + 2, offset + 2 + tagLength));
final String value = String.fromCharCodes(bytes.sublist(offset + 2 + tagLength, offset + length));
return CAAResponseRecord(
name: name,
ttl: ttl,
flags: flags,
tag: tag,
value: value);
}