getName method

String getName()

Get a name */

Implementation

String getName() {
  var a = getUint8List(8);
  var result = '';
  for (var bit = 63; bit >= 0;) {
    var c = 0;
    for (var i = 0; i < 5; ++i) {
      if (bit >= 0) {
        c = (c << 1) | ((a[(bit / 8).floor()] >> (bit % 8)) & 1);
        --bit;
      }
    }
    if (c >= 6) {
      result += String.fromCharCode(c + 'a'.codeUnitAt(0) - 6);
    } else if (c >= 1) {
      result += String.fromCharCode(c + '1'.codeUnitAt(0) - 1);
    } else {
      result += '.';
    }
  }
  while (result.endsWith('.')) {
    result = result.substring(0, result.length - 1);
  }
  return result;
}