11import 'package:bloc/bloc.dart' ;
2- import 'package:bloc_concurrency/bloc_concurrency.dart' ;
32import 'package:core/core.dart' ;
43import 'package:data_repository/data_repository.dart' ;
54import 'package:equatable/equatable.dart' ;
@@ -16,8 +15,6 @@ final class _FetchNextLanguagePage extends EditSourceEvent {
1615 const _FetchNextLanguagePage ();
1716}
1817
19- const _searchDebounceDuration = Duration (milliseconds: 300 );
20-
2118/// A BLoC to manage the state of editing a single source.
2219class EditSourceBloc extends Bloc <EditSourceEvent , EditSourceState > {
2320 /// {@macro edit_source_bloc}
@@ -26,11 +23,11 @@ class EditSourceBloc extends Bloc<EditSourceEvent, EditSourceState> {
2623 required DataRepository <Country > countriesRepository,
2724 required DataRepository <Language > languagesRepository,
2825 required String sourceId,
29- }) : _sourcesRepository = sourcesRepository,
30- _countriesRepository = countriesRepository,
31- _languagesRepository = languagesRepository,
32- _sourceId = sourceId,
33- super (const EditSourceState ()) {
26+ }) : _sourcesRepository = sourcesRepository,
27+ _countriesRepository = countriesRepository,
28+ _languagesRepository = languagesRepository,
29+ _sourceId = sourceId,
30+ super (const EditSourceState ()) {
3431 on < EditSourceLoaded > (_onLoaded);
3532 on < EditSourceNameChanged > (_onNameChanged);
3633 on < EditSourceDescriptionChanged > (_onDescriptionChanged);
@@ -74,7 +71,7 @@ class EditSourceBloc extends Bloc<EditSourceEvent, EditSourceState> {
7471 // Find the equivalent language object from the full list.
7572 // This ensures the DropdownButton can identify it by reference.
7673 selectedLanguage = languagesPaginated.items.firstWhere (
77- (listLanguage) => listLanguage.id == source.language? .id,
74+ (listLanguage) => listLanguage.id == source.language.id,
7875 );
7976 } catch (_) {
8077 selectedLanguage = source.language;
@@ -212,6 +209,7 @@ class EditSourceBloc extends Bloc<EditSourceEvent, EditSourceState> {
212209 try {
213210 emit (state.copyWith (countriesIsLoadingMore: true ));
214211
212+ // ignore: inference_failure_on_instance_creation
215213 await Future .delayed (const Duration (milliseconds: 400 ));
216214
217215 final nextCountries = await _countriesRepository.readAll (
@@ -246,6 +244,7 @@ class EditSourceBloc extends Bloc<EditSourceEvent, EditSourceState> {
246244 try {
247245 emit (state.copyWith (languagesIsLoadingMore: true ));
248246
247+ // ignore: inference_failure_on_instance_creation
249248 await Future .delayed (const Duration (milliseconds: 400 ));
250249
251250 final nextLanguages = await _languagesRepository.readAll (
0 commit comments