detachAndDisposeDeferredSession function

void detachAndDisposeDeferredSession(
  1. Factory? session
)

Detach first so the replay worker drains before the session dies.

Implementation

void detachAndDisposeDeferredSession(Factory? session) {
  if (session == null) {
    return;
  }
  final texture = deferredAttachedTexture(session);
  if (texture is RenderTexture && !texture.isDisposed) {
    texture.useDeferredSession(null);
  }
  if (session is DeferredSessionFactory) {
    session.dispose();
  }
}