Uuid.fromBytes constructor
Uuid.fromBytes(
- Uint8List uuidBytes
Construct a UUID from the given byte list.
The given uuidBytes
will be copied to prevent modifications.
This method throws an ArgumentError if, and only if, the uuidBytes
list wasn't exactly 16 bytes (see kUuidBytes
) long.
Implementation
factory Uuid.fromBytes(Uint8List uuidBytes) {
if (uuidBytes.lengthInBytes != kUuidBytes) {
throw ArgumentError.value(
uuidBytes,
'uuidBytes',
'Must be $kUuidBytes bytes long, was ${uuidBytes.lengthInBytes}',
);
}
final copy = Uint8List.fromList(uuidBytes);
return Uuid._fromValidBytes(copy);
}