SelectOneBloc<T> constructor
SelectOneBloc<T> (
- List<
T> ? items, - Future<
List< onFind(T> ?>- String text
- TextEditingController? findController
Implementation
SelectOneBloc(List<T>? items, Future<List<T>?> Function(String text)? onFind, TextEditingController? findController) {
this.findController = findController ?? TextEditingController();
_list$ = BehaviorSubject.seeded(items);
_filteredListOfflineOut = CombineLatestStream.combine2(_list$, _filter$, filter);
_filteredListOnlineOut = _filter$.where((_) => onFind != null).distinct().debounceTime(Duration(milliseconds: 500)).switchMap((val) => Stream.fromFuture(onFind!(val)).startWith(null));
filteredListOut = MergeStream([
_filteredListOfflineOut,
_filteredListOnlineOut
]);
this.findController.addListener(() => onTextChanged(this.findController.text));
onTextChanged(this.findController.text);
}