How I can show last 5 elements in widget with listview.builder?
Thanks!
if (snapshot.hasData) {
return ListView.builder(
controller: controller,
// shrinkWrap: true,
// reverse: true,
itemCount: snapshot.data!.length ,
itemBuilder: (BuildContext context, int index) {
// controller.jumpTo(controller.position.maxScrollExtent);
if (snapshot.data![index].operatorName == 'barz1' ||
snapshot.data![index].operatorName == 'barz2') {
return Container(
4
Answers
You can set
reverse
property true inListview.builder
and setitemcount
to 5 to get last 5 elements in widget withListView.Builder
.you can use this method
Try this:
You can create sublist from original data.