str128 property

String str128

Implementation

String get str128 {
  if (bytes.length == 2) {
    // 16-bit uuid
    return '0000${_hexEncode(bytes)}-0000-1000-8000-00805f9b34fb'.toLowerCase();
  }
  if (bytes.length == 4) {
    // 32-bit uuid
    return '${_hexEncode(bytes)}-0000-1000-8000-00805f9b34fb'.toLowerCase();
  }
  // 128-bit uuid
  String one = _hexEncode(bytes.sublist(0, 4));
  String two = _hexEncode(bytes.sublist(4, 6));
  String three = _hexEncode(bytes.sublist(6, 8));
  String four = _hexEncode(bytes.sublist(8, 10));
  String five = _hexEncode(bytes.sublist(10, 16));
  return "$one-$two-$three-$four-$five".toLowerCase();
}