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()){
localDS.cacheDropDownValue(localKey, value ?? "");
emit(UIDropdownInitState(value ?? options.first, options));
on<UIDropDownSelectItemEvent>((event, emit) async {
_toLoadingState();
value = event.value;
localDS.cacheDropDownValue(localKey, value ?? "");
emit(UIDropdownInitState(event.value, options));
});
on<UIDropDownShowErrorEvent>((event, emit) {
_toLoadingState();
emit(UIDropDownErrorState(event.message, options, value ?? ""));
});
on<UIDropDownProcessingEvent>((event, emit) {
_toLoadingState();
});
}