decode method

dynamic decode()

Implementation

dynamic decode() {
  final u = _list[_offset++];
  if (u <= 127) {
    return u;
  } else if ((u & 0xE0) == 0xE0) {
    // negative small integer
    return u - 256;
  } else if ((u & 0xE0) == 0xA0) {
    return _readString(u & 0x1F);
  } else if ((u & 0xF0) == 0x90) {
    return _readArray(u & 0xF);
  } else if ((u & 0xF0) == 0x80) {
    return _readMap(u & 0xF);
  }
  switch (u) {
    case 0xc0:
      return null;
    case 0xc2:
      return false;
    case 0xc3:
      return true;
    case 0xcc:
      return _readUInt8();
    case 0xcd:
      return _readUInt16();
    case 0xce:
      return _readUInt32();
    case 0xcf:
      return _readUInt64();
    case 0xd0:
      return _readInt8();
    case 0xd1:
      return _readInt16();
    case 0xd2:
      return _readInt32();
    case 0xd3:
      return _readInt64();
    case 0xca:
      return _readFloat();
    case 0xcb:
      return _readDouble();
    case 0xd9:
      return _readString(_readUInt8());
    case 0xda:
      return _readString(_readUInt16());
    case 0xdb:
      return _readString(_readUInt32());
    case 0xc4:
      return _readBuffer(_readUInt8());
    case 0xc5:
      return _readBuffer(_readUInt16());
    case 0xc6:
      return _readBuffer(_readUInt32());
    case 0xdc:
      return _readArray(_readUInt16());
    case 0xdd:
      return _readArray(_readUInt32());
    case 0xde:
      return _readMap(_readUInt16());
    case 0xdf:
      return _readMap(_readUInt32());
    case 0xd4:
      return _readExt(1);
    case 0xd5:
      return _readExt(2);
    case 0xd6:
      return _readExt(4);
    case 0xd7:
      return _readExt(8);
    case 0xd8:
      return _readExt(16);
    case 0xc7:
      return _readExt(_readUInt8());
    case 0xc8:
      return _readExt(_readUInt16());
    case 0xc9:
      return _readExt(_readUInt32());
    default:
      throw FormatError("Invalid MessagePack format");
  }
}