There are a few similar problems on the site but I could not make up exactly
Widget _buildBody(tab) {
return BlocBuilder(
bloc: _lessonsBloc,
builder: (BuildContext context, LessonsState state) { //HERE
if (state is LessonsLoading) {
return Center(
child: CircularProgressIndicator(),
);
} else if (state is LessonsLoaded) {
return ListView.builder(
itemCount: state.lessons.length,
itemBuilder: (context, index) {
final displayedLessons = state.lessons[index];
return ListTile(
title: Text(displayedLessons.name),
subtitle:Text(displayedLessons.subname),
trailing: _buildUpdateDeleteButtons(displayedLessons),
);
},
);
}
},
);
}
This is my code and I get the warning in the header where builder is.
I would appreciate it if someone give a solution or an idea:)
You need to return widget from within the build()
method and you missed a case.
Widget _buildBody() {
return BlocBuilder(
bloc: _lessonsBloc,
builder: (BuildContext context, LessonsState state) {
if (state is LessonsLoading) {
return Widget1();
} else if (state is LessonsLoaded) {
return Widget2();
}
return CircularProgressIndicator(); // You missed this return statement.
},
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With