resolveStreamsByProperty static method
Future<List<LSLStreamInfo> >
resolveStreamsByProperty({
- required LSLStreamProperty property,
- required String value,
- double waitTime = 5.0,
- int minStreamCount = 0,
- int maxStreams = 5,
Discovers LSL streams matching a specific property value.
This method filters streams based on a single property-value pair, making it ideal for finding streams by name, type, or other specific characteristics.
Parameters:
property
: The stream property to filter by (see LSLStreamProperty)value
: The exact value to match (case-sensitive)waitTime
: Maximum wait time in seconds (default: 5.0)minStreamCount
: Minimum streams to find before returning (default: 0)maxStreams
: Maximum streams to return (default: 5)
Available Properties:
name
: Stream name (exact match)type
: Content type (e.g., 'EEG', 'EMG', 'Audio')channelCount
: Number of channels (as string)sampleRate
: Sampling rate (as string with full precision)channelFormat
: Data format (e.g., 'float32', 'int16')sourceId
: Unique source identifier
Usage Examples:
// Find EEG streams
final eegStreams = await LSL.resolveStreamsByProperty(
property: LSLStreamProperty.type,
value: 'EEG',
waitTime: 2.0,
);
// Find a specific stream by name
final myStream = await LSL.resolveStreamsByProperty(
property: LSLStreamProperty.name,
value: 'MyDataStream',
waitTime: 1.0,
);
Returns: List of LSLStreamInfo objects matching the criteria
Note: If minStreamCount
> 0 and waitTime
> 0, the method may
return fewer streams than requested if the timeout is reached.
See Also:
- resolveStreamsByPredicate for complex filtering with XPath
- resolveStreams for discovering all streams
Implementation
static Future<List<LSLStreamInfo>> resolveStreamsByProperty({
required LSLStreamProperty property,
required String value,
double waitTime = 5.0,
int minStreamCount = 0,
int maxStreams = 5,
}) async {
final resolver = createResolver(maxStreams: maxStreams);
final streams = await resolver.resolveByProperty(
property: property,
value: value,
waitTime: waitTime,
minStreamCount: minStreamCount,
);
// free the resolver
resolver.destroy();
// these stream info pointers remain until they are destroyed
return streams;
}