fromBytes static method
Implementation
static Uint128 fromBytes(
List<int> bytes, {
Endian endian = Endian.big,
int offset = 0,
}) {
if (offset < 0 || bytes.length - offset < 16) {
throw ArgumentException.invalidOperationArguments(
"Uint128.fromBytes",
reason: 'Need at least 16 bytes from offset.',
details: {
"offset": offset.toString(),
"length": bytes.length.toString(),
},
);
}
if (endian == Endian.big) {
final hi = Uint64.fromBytes(bytes, endian: Endian.big, offset: offset);
final lo = Uint64.fromBytes(
bytes,
endian: Endian.big,
offset: offset + 8,
);
return Uint128._(hi, lo);
} else {
final lo = Uint64.fromBytes(bytes, endian: Endian.little, offset: offset);
final hi = Uint64.fromBytes(
bytes,
endian: Endian.little,
offset: offset + 8,
);
return Uint128._(hi, lo);
}
}