InternetAddress.fromRawAddress constructor
InternetAddress.fromRawAddress(
- Uint8List rawAddress, {
- InternetAddressType? type,
Creates a new InternetAddress from the provided raw address bytes.
If the type is InternetAddressType.IPv4, the rawAddress must have
length 4.
If the type is InternetAddressType.IPv6, the rawAddress must have
length 16.
If the type is InternetAddressType.IPv4, the rawAddress must be a
valid UTF-8 encoded file path.
If type is omitted, the rawAddress must have a length of either 4 or
16, in which case the type defaults to InternetAddressType.IPv4 or
InternetAddressType.IPv6 respectively.
Implementation
factory InternetAddress.fromRawAddress(Uint8List rawAddress,
{InternetAddressType? type}) {
if (type == InternetAddressType.unix) {
return InternetAddress(utf8.decode(rawAddress), type: type);
}
final address = _stringFromIp(rawAddress);
type = _type(address);
return InternetAddress._(
address: address,
rawAddress: rawAddress,
type: type,
);
}