releaseTarget method

Future<void> releaseTarget()

Lets go of the session's surface or textures, and keeps the rest of the session.

Use it when the platform takes a surface away, such as when your app goes to the background. Release every acquired frame first. Frame demands that are still pending, and later ones until you give the session a new target, finish with RenderResult.targetNotReady. Once the release completes, you can destroy the old target.

See mln_render_session_release_target in the C API reference.

Errors:

  • Status.unsupported when the session renders offscreen or into Android hardware buffers, dmabufs, DXGI shared textures, or IOSurfaces that it allocates.
  • Status.unsupported when the target is a WebGL canvas.
  • Status.targetLost when the session loses its target before the release runs.

Implementation

Future<void> releaseTarget() => _run(
  (arena, completion) => raw.mln_render_session_release_target(
    _handle.raw,
    completion,
    nativeDiagnostic,
  ),
);