fitSelect<T> method
Selector system - get or create a stream for specific data
Implementation
Stream<T> fitSelect<T>(String key, T Function() selector) {
if (_isDisposed) return Stream.empty();
if (!_selectorControllers.containsKey(key)) {
_selectorControllers[key] = StreamController<T>.broadcast();
}
final controller = _selectorControllers[key] as StreamController<T>;
// Add current value immediately
try {
final currentValue = selector();
if (!controller.isClosed) {
controller.add(currentValue);
}
} catch (e) {
debugPrint('Error in fitSelect selector: $e');
}
return controller.stream;
}