static PointerDataPacket _unpackPointerDataPacket(ByteData packet) { const int kStride = 8; // Its an 8 const anyway - Int64List.bytesPerElement; const int kBytesPerPointerData = _kPointerDataFieldCount * kStride; int length = packet.lengthInBytes / kBytesPerPointerData; //assert(length * kBytesPerPointerData == packet.lengthInBytes); List <PointerData> data = new List <PointerData>(length); for (int i = 0; i < length; ++i) { int offset = i * _kPointerDataFieldCount; data[i] = new PointerData( timeStamp: new Duration(microseconds: packet.getInt64(kStride * offset++, (int)_kFakeHostEndian)), change: (PointerChange)packet.getInt64(kStride * offset++, (int)_kFakeHostEndian), kind: (PointerDeviceKind)packet.getInt64(kStride * offset++, (int)_kFakeHostEndian), device: packet.getInt64(kStride * offset++, (int)_kFakeHostEndian), physicalX: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), physicalY: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), buttons: packet.getInt64(kStride * offset++, (int)_kFakeHostEndian), obscured: packet.getInt64(kStride * offset++, (int)_kFakeHostEndian) != 0, pressure: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), pressureMin: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), pressureMax: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), distance: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), distanceMax: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), radiusMajor: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), radiusMinor: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), radiusMin: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), radiusMax: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), orientation: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian), tilt: packet.getFloat64(kStride * offset++, (int)_kFakeHostEndian) ); //assert(offset == (i + 1) * _kPointerDataFieldCount); } return(new PointerDataPacket(data: data)); }