pushSampleSync method
Synchronously pushes a sample to the outlet.
Direct mode only - throws LSLException if useIsolates: true
.
This provides maximum timing precision by eliminating all async overhead. Ideal for high-frequency data streaming or when precise timing is critical.
Example:
final outlet = await LSL.createOutlet(streamInfo: info, useIsolates: false);
// High-precision sampling loop
while (streaming) {
final data = generateSample();
outlet.pushSampleSync(data); // Zero async overhead
}
Returns: Error code (0 = success).
See also: pushSample for async operations
Throws: LSLException if useIsolates: true
or data validation fails.
Implementation
int pushSampleSync(List<dynamic> data) =>
requireDirect(() => _pushSampleDirect(data));