Guid.tryParseBytes constructor

Guid.tryParseBytes(
  1. Uint8List guid
)

Initializes a new instance of the Guid structure by using the specified array of bytes.

Like parseBytes except that this function returns null where a similar call to parse would throw a FormatException.

Implementation

factory Guid.tryParseBytes(Uint8List guid) {
  if (guid.isNotEmpty && _Guid.isValidGUID(fromByteList: guid)) {
    return Guid._(GuidValue(_Guid.unparse(guid), guid));
  }

  return Guid._();
}