• 1000 1005 * Idk, если это проблема
Bloc
или я делаю что-то не так.
My BlocProvider:
BlocProvider<PlacesBloc> buildBody(BuildContext context) {
return BlocProvider(
create: (_) => sl<PlacesBloc>(),
child: Center(
child: Padding(
padding: const EdgeInsets.all(10),
child: Column(
children: <Widget>[
// Top view
SizedBox(height: 20),
PlacesControls(),
// Bottom view
BlocBuilder<PlacesBloc, PlacesState>(
// ignore: missing_return
builder: (context, state) {
if (state is Empty) {
return MessageDisplay(
message: 'Search places around you!',
);
} else if (state is Loading) {
return LoadingWidget();
} else if (state is Loaded) {
return PlacesDisplay(places: state.places);
} else if (state is Error) {
return MessageDisplay(
message: state.message,
);
}
},
),
],
),
),
),
);
}
* Параметр 1012 * не существует в моей версии Blo c .
Также внутри моего Widget
я использую BlocProvider.of<PlacesBloc>(context).add(GetPlacesFromServer());
, чтобы добавить событие в мой 'BlocProvider', но этот .add
метод не существует в моем Blo c.
Вот различия конструкторов между обучающим видео (внизу) и моим (вверху):
введите описание изображения здесь