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(