createPhysicsWorld function

PhysicsWorld createPhysicsWorld()

Creates a physics world.

Android uses Jolt through dart:ffi. Other platforms currently receive a lightweight preview backend so UI development and tests can run without an Android runtime.

Implementation

PhysicsWorld createPhysicsWorld() {
  if (Platform.isAndroid) {
    try {
      return _JoltPhysicsWorld();
    } on Object {
      // Keep previews and tests usable while the native Android library is absent.
    }
  }
  return _PreviewPhysicsWorld();
}