setFrameUpdates method

Future<void> setFrameUpdates(
  1. bool enabled, {
  2. double x = 0,
  3. double y = 0,
  4. int hz = 20,
})

Starts or stops throttled per-frame updates, delivered to onFrameUpdate.

Each sample hit-tests the reticle position x, y (device pixels) and includes the camera matrices. It runs natively inside the existing ARCore frame loop, so it costs one channel message per sample rather than a request/response round-trip per frame. hz caps the sample rate.

Implementation

Future<void> setFrameUpdates(
  bool enabled, {
  double x = 0,
  double y = 0,
  int hz = 20,
}) async {
  try {
    await _channel.invokeMethod<void>('setReticleEnabled', {
      'enabled': enabled,
      'x': x,
      'y': y,
      'hz': hz,
    });
  } catch (e) {
    if (debug) {
      print('setFrameUpdates failed: $e');
    }
  }
}