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
}
See pushSample for timestamp and pushthrough semantics.
Returns: Error code (0 = success).
See also: pushSample for async operations
Throws: LSLException if useIsolates: true or data validation fails.
Implementation
int pushSampleSync(
Iterable<dynamic> data, {
double? timestamp,
bool? pushthrough,
}) => requireDirect(() => _pushSampleDirect(data, timestamp, pushthrough));