import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:mobiles_labs_5th_semester/data/repositories/games_repository.dart'; import 'package:mobiles_labs_5th_semester/presentation/details_page/bloc/state.dart'; import 'event.dart'; class GameDetailsBloc extends Bloc { final GamesRepository repo; GameDetailsBloc(this.repo) : super(const GameDetailsState()) { on(_onLoadDetails); } //Emitter - генератор событий Future _onLoadDetails(LoadGameDetailsEvent event, Emitter emit) async { final data = await repo.loadGameData(event.gameId); emit(state.copyWith( gameData: data, )); } }