dispose method

  1. @override
void dispose()
override

Destroys the world and everything in it. Safe to call twice.

Implementation

@override
void dispose() {
  if (_disposed) return;
  _disposed = true;
  _worldFinalizer.detach(this);
  jj_world_destroy(handle);
  shapes.clear();
  _bodyShapes.clear();
  _bodyTypes.clear();
  _jointBodies.clear();
  _bodyJoints.clear();
  _characters.clear();
  for (final address in List.of(_owned.keys)) {
    _drop(Pointer<Uint8>.fromAddress(address));
  }
}