androidFramePacerCreate function

FramePacerHandle androidFramePacerCreate({
  1. FramePacerOptions? options,
})

Creates a frame pacer that follows the display through the calling thread's AChoreographer.

Call it on a thread with an ALooper, such as the app's main thread, and keep that thread running its looper while sessions use the pacer.

See mln_android_frame_pacer_create in the C API reference.

Errors:

  • Status.invalidState when the calling thread has no ALooper.

Implementation

FramePacerHandle androidFramePacerCreate({FramePacerOptions? options}) =>
    withNativeArena((arena) {
      ensureAbiVersion();
      final outPacer = arena<Uint64>();
      _check(
        raw.mln_android_frame_pacer_create(
          options == null ? nullptr : _writeFramePacerOptions(options, arena),
          outPacer,
          nativeDiagnostic,
        ),
      );
      return _adoptOwned(
        outPacer.value,
        () => FramePacerHandle._(_NativeFramePacer(outPacer.value)),
        (handle) {
          raw.mln_frame_pacer_release(handle);
        },
      );
    });