pullSampleSync method

LSLSample<T> pullSampleSync({
  1. double timeout = 0.0,
})

Synchronously pulls a sample from the inlet.

Direct mode only - throws LSLException if useIsolates: true.

This provides maximum timing precision by eliminating all async overhead. Ideal for high-frequency sampling or when precise timing is critical.

Example:

final inlet = await LSL.createInlet<double>(streamInfo: info, useIsolates: false);

// High-precision sampling loop
while (running) {
  final sample = inlet.pullSampleSync(timeout: 0.001);
  if (sample.isNotEmpty) {
    processSample(sample);
  }
}

Returns: A LSLSample containing the data, timestamp, and error code. See also: pullSample for async operations Throws: LSLException if useIsolates: true.

Implementation

LSLSample<T> pullSampleSync({double timeout = 0.0}) =>
    requireDirect(() => _pullSampleDirect(timeout));