@@ -31,17 +31,9 @@ class CreateSourceBloc extends Bloc<CreateSourceEvent, CreateSourceState> {
3131 on < CreateSourceHeadquartersChanged > (_onHeadquartersChanged);
3232 on < CreateSourceStatusChanged > (_onStatusChanged);
3333 on < CreateSourceSubmitted > (_onSubmitted);
34- on < CreateSourceCountrySearchChanged > (
35- _onCountrySearchChanged,
36- transformer: droppable (),
37- );
3834 on < CreateSourceLoadMoreCountriesRequested > (
3935 _onLoadMoreCountriesRequested,
4036 );
41- on < CreateSourceLanguageSearchChanged > (
42- _onLanguageSearchChanged,
43- transformer: droppable (),
44- );
4537 on < CreateSourceLoadMoreLanguagesRequested > (
4638 _onLoadMoreLanguagesRequested,
4739 );
@@ -186,37 +178,6 @@ class CreateSourceBloc extends Bloc<CreateSourceEvent, CreateSourceState> {
186178 }
187179 }
188180
189- Future <void > _onCountrySearchChanged (
190- CreateSourceCountrySearchChanged event,
191- Emitter <CreateSourceState > emit,
192- ) async {
193- await Future <void >.delayed (_searchDebounceDuration);
194- emit (state.copyWith (countrySearchTerm: event.searchTerm));
195- try {
196- final countriesResponse = await _countriesRepository.readAll (
197- filter: event.searchTerm.isNotEmpty ? {'name' : event.searchTerm} : null ,
198- sort: [const SortOption ('name' , SortOrder .asc)],
199- );
200-
201- emit (
202- state.copyWith (
203- countries: countriesResponse.items,
204- countriesCursor: countriesResponse.cursor,
205- countriesHasMore: countriesResponse.hasMore,
206- ),
207- );
208- } on HttpException catch (e) {
209- emit (state.copyWith (status: CreateSourceStatus .failure, exception: e));
210- } catch (e) {
211- emit (
212- state.copyWith (
213- status: CreateSourceStatus .failure,
214- exception: UnknownException ('An unexpected error occurred: $e ' ),
215- ),
216- );
217- }
218- }
219-
220181 Future <void > _onLoadMoreCountriesRequested (
221182 CreateSourceLoadMoreCountriesRequested event,
222183 Emitter <CreateSourceState > emit,
@@ -230,9 +191,6 @@ class CreateSourceBloc extends Bloc<CreateSourceEvent, CreateSourceState> {
230191 pagination: state.countriesCursor != null
231192 ? PaginationOptions (cursor: state.countriesCursor)
232193 : null ,
233- filter: state.countrySearchTerm.isNotEmpty
234- ? {'name' : state.countrySearchTerm}
235- : null ,
236194 sort: [const SortOption ('name' , SortOrder .asc)],
237195 );
238196
@@ -263,37 +221,6 @@ class CreateSourceBloc extends Bloc<CreateSourceEvent, CreateSourceState> {
263221 }
264222 }
265223
266- Future <void > _onLanguageSearchChanged (
267- CreateSourceLanguageSearchChanged event,
268- Emitter <CreateSourceState > emit,
269- ) async {
270- await Future <void >.delayed (_searchDebounceDuration);
271- emit (state.copyWith (languageSearchTerm: event.searchTerm));
272- try {
273- final languagesResponse = await _languagesRepository.readAll (
274- filter: event.searchTerm.isNotEmpty ? {'name' : event.searchTerm} : null ,
275- sort: [const SortOption ('name' , SortOrder .asc)],
276- );
277-
278- emit (
279- state.copyWith (
280- languages: languagesResponse.items,
281- languagesCursor: languagesResponse.cursor,
282- languagesHasMore: languagesResponse.hasMore,
283- ),
284- );
285- } on HttpException catch (e) {
286- emit (state.copyWith (status: CreateSourceStatus .failure, exception: e));
287- } catch (e) {
288- emit (
289- state.copyWith (
290- status: CreateSourceStatus .failure,
291- exception: UnknownException ('An unexpected error occurred: $e ' ),
292- ),
293- );
294- }
295- }
296-
297224 Future <void > _onLoadMoreLanguagesRequested (
298225 CreateSourceLoadMoreLanguagesRequested event,
299226 Emitter <CreateSourceState > emit,
@@ -307,9 +234,6 @@ class CreateSourceBloc extends Bloc<CreateSourceEvent, CreateSourceState> {
307234 pagination: state.languagesCursor != null
308235 ? PaginationOptions (cursor: state.languagesCursor)
309236 : null ,
310- filter: state.languageSearchTerm.isNotEmpty
311- ? {'name' : state.languageSearchTerm}
312- : null ,
313237 sort: [const SortOption ('name' , SortOrder .asc)],
314238 );
315239
0 commit comments