Лаб 6 (мелкая правка)

This commit is contained in:
ujijrujijr 2024-11-24 18:40:39 +04:00
parent 9abe984288
commit d41a1e2465
2 changed files with 5 additions and 7 deletions

View File

@ -12,9 +12,7 @@ class GameDetailsBloc extends Bloc<GameDetailsEvent, GameDetailsState> {
} }
//Emitter - генератор событий //Emitter - генератор событий
Future<void> _onLoadDetails(LoadGameDetailsEvent event, Future<void> _onLoadDetails(LoadGameDetailsEvent event, Emitter<GameDetailsState> emit) async {
Emitter<GameDetailsState> emit) async {
String? error;
final data = await repo.loadGameData(event.gameId); final data = await repo.loadGameData(event.gameId);
emit(state.copyWith( emit(state.copyWith(
gameData: data, gameData: data,

View File

@ -7,7 +7,7 @@ import 'bloc/event.dart';
import 'bloc/state.dart'; import 'bloc/state.dart';
class DetailsPage extends StatelessWidget { class DetailsPage extends StatelessWidget {
final int? gameId; final int gameId;
const DetailsPage(this.gameId, {super.key}); const DetailsPage(this.gameId, {super.key});
@ -16,7 +16,7 @@ class DetailsPage extends StatelessWidget {
return BlocProvider( return BlocProvider(
create: (context) { create: (context) {
final bloc = GameDetailsBloc(GamesRepository()); final bloc = GameDetailsBloc(GamesRepository());
bloc.add(LoadGameDetailsEvent(gameId: gameId!)); bloc.add(LoadGameDetailsEvent(gameId: gameId));
return bloc; return bloc;
}, },
child: Scaffold( child: Scaffold(