From d41a1e246552a50b95234a18f8e0145dfd32a272 Mon Sep 17 00:00:00 2001 From: ujijrujijr Date: Sun, 24 Nov 2024 18:40:39 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=206=20(=D0=BC=D0=B5=D0=BB?= =?UTF-8?q?=D0=BA=D0=B0=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/presentation/details_page/bloc/bloc.dart | 8 +++----- lib/presentation/details_page/details_page.dart | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/presentation/details_page/bloc/bloc.dart b/lib/presentation/details_page/bloc/bloc.dart index 9a9b4b1..0579329 100644 --- a/lib/presentation/details_page/bloc/bloc.dart +++ b/lib/presentation/details_page/bloc/bloc.dart @@ -7,17 +7,15 @@ import 'event.dart'; class GameDetailsBloc extends Bloc { final GamesRepository repo; - GameDetailsBloc(this.repo) : super (const GameDetailsState()) { + GameDetailsBloc(this.repo) : super(const GameDetailsState()) { on(_onLoadDetails); } //Emitter - генератор событий - Future _onLoadDetails(LoadGameDetailsEvent event, - Emitter emit) async { - String? error; + Future _onLoadDetails(LoadGameDetailsEvent event, Emitter emit) async { final data = await repo.loadGameData(event.gameId); emit(state.copyWith( gameData: data, )); } -} \ No newline at end of file +} diff --git a/lib/presentation/details_page/details_page.dart b/lib/presentation/details_page/details_page.dart index 9b51458..05d5722 100644 --- a/lib/presentation/details_page/details_page.dart +++ b/lib/presentation/details_page/details_page.dart @@ -7,7 +7,7 @@ import 'bloc/event.dart'; import 'bloc/state.dart'; class DetailsPage extends StatelessWidget { - final int? gameId; + final int gameId; const DetailsPage(this.gameId, {super.key}); @@ -16,7 +16,7 @@ class DetailsPage extends StatelessWidget { return BlocProvider( create: (context) { final bloc = GameDetailsBloc(GamesRepository()); - bloc.add(LoadGameDetailsEvent(gameId: gameId!)); + bloc.add(LoadGameDetailsEvent(gameId: gameId)); return bloc; }, child: Scaffold(