Лаб 6 (мелкая правка)
This commit is contained in:
parent
9abe984288
commit
d41a1e2465
@ -12,9 +12,7 @@ class GameDetailsBloc extends Bloc<GameDetailsEvent, GameDetailsState> {
|
||||
}
|
||||
|
||||
//Emitter - генератор событий
|
||||
Future<void> _onLoadDetails(LoadGameDetailsEvent event,
|
||||
Emitter<GameDetailsState> emit) async {
|
||||
String? error;
|
||||
Future<void> _onLoadDetails(LoadGameDetailsEvent event, Emitter<GameDetailsState> emit) async {
|
||||
final data = await repo.loadGameData(event.gameId);
|
||||
emit(state.copyWith(
|
||||
gameData: data,
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user