fromBytes static method
Implementation
static AResponseRecord fromBytes({
required String name,
required int ttl,
required Uint8List bytes,
required int offset,
required int length }) {
// Length validation
if((length != 4) || ((offset + length) > bytes.length)) {
throw FormatException('Invalid bytes length for A record.');
}
// Create the IPv4
final String ipString = bytes
.sublist(offset, offset + length)
.join('.');
// Create instance
return AResponseRecord(
name: name,
ttl: ttl,
ip: InternetAddress.tryParse(ipString)!
);
}