userDatas property
The non-null userData of the bodies and shapes involved in this contact, in the order body A, shape A, body B, shape B.
Shapes that have already been destroyed are skipped, since their userData is removed together with them.
Implementation
Set<Object> get userDatas {
final userDatas = <Object>{};
for (final shape in [shapeA, shapeB]) {
if (!shape.isValid) {
continue;
}
final bodyUserData = shape.body.userData;
if (bodyUserData != null) {
userDatas.add(bodyUserData);
}
final shapeUserData = shape.userData;
if (shapeUserData != null) {
userDatas.add(shapeUserData);
}
}
return userDatas;
}