-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(bloc): replace latest national statistic bloc with cubit
- Loading branch information
1 parent
cc4cf84
commit 0231d63
Showing
10 changed files
with
47 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export 'latest_covid_test/latest_covid_test_bloc.dart'; | ||
export 'latest_national_statistic/latest_national_statistic_bloc.dart'; |
33 changes: 0 additions & 33 deletions
33
.../lib/src/presentation/blocs/latest_national_statistic/latest_national_statistic_bloc.dart
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...lib/src/presentation/blocs/latest_national_statistic/latest_national_statistic_event.dart
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export 'all_national_statistics/all_national_statistics_cubit.dart'; | ||
export 'all_statistic_filter/all_statistic_filter_cubit.dart'; | ||
export 'all_statistics/all_statistics_cubit.dart'; | ||
export 'latest_national_statistic/latest_national_statistic_cubit.dart'; | ||
export 'latest_statistic/latest_statistic_cubit.dart'; | ||
export 'line_chart_filter/line_chart_filter_cubit.dart'; |
25 changes: 25 additions & 0 deletions
25
...ib/src/presentation/cubits/latest_national_statistic/latest_national_statistic_cubit.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'package:core/core.dart'; | ||
import 'package:dependencies/dependencies.dart'; | ||
import 'package:statistic/src/domain/usecases/get_latest_national_statistic.dart'; | ||
import 'package:statistic/statistic.dart'; | ||
|
||
part 'latest_national_statistic_state.dart'; | ||
part 'latest_national_statistic_cubit.freezed.dart'; | ||
|
||
class LatestNationalStatisticCubit extends Cubit<LatestNationalStatisticState> { | ||
LatestNationalStatisticCubit() | ||
: super( | ||
LatestNationalStatisticState.initial(), | ||
); | ||
|
||
final _usecase = getIt<GetLatestNationalStatistic>(); | ||
|
||
Future<void> fetch() async { | ||
emit(LatestNationalStatisticState.loading()); | ||
final result = await _usecase.call(NoParams()); | ||
result.fold( | ||
(l) => emit(LatestNationalStatisticState.failed(failure: l)), | ||
(r) => emit(LatestNationalStatisticState.loaded(data: r)), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters