UIDropDownBloc constructor
UIDropDownBloc(
- IuITemplateLocalDatasource localDS,
- List<
String> options, - String? value, {
- String localKey = "ui_dropdown_bloc_value",
Implementation
UIDropDownBloc(this.localDS, this.options, this.value, {this.localKey = "ui_dropdown_bloc_value"}):super(UIDropDownLoadingState()){
if(value?.isEmpty ?? false){
value = options.first;
}
on<UIDropDownSelectItemEvent>((event, emit) {
_toLoadingState();
value = event.value;
emit(UIDropdownInitState(event.value, options));
});
on<UIDropDownShowErrorEvent>((event, emit) {
_toLoadingState();
emit(UIDropDownErrorState(event.message, options, value ?? ""));
});
on<UIDropDownProcessingEvent>((event, emit) {
_toLoadingState();
});
}