FlutterListView with additional features.

try again widget empty widget refresh indicator load more items loading


  • flutter list view
  • pagination option (infinity scroll)
  • view model detection using generic types
  • refresh option
  • error handling while getting data
  • show empty widget when list is empty
  • show loading widget while getting data
  • easy usage
  • makes your code clean and readable

Getting started


    import 'package:advanced_list_view/advanced_list_view.dart';


Define your listview (PersonViewModel is your model which will return to you on itemBuilder and you can use current item value):

    items: listItems,
    canRefresh: true,
    showLoadingWidget: showLoadingWidget,
    showErrorWidget: showErrorWidget,
    shrinkWrap: true,
    showEmptyWidget: showEmptyWidget,
    onRefresh: _onRefresh,
    onLoadMoreData: _onLoadMoreData,
    hasMoreData: _hasMoreData,
    (final BuildContext context, final int index, final item) =>
    title: Text(item.name),

your onLoadMoreData function that will be called when user scrolls to end of list and offset value will be increment:

    Future<void> _onLoadMoreData() async {
  setState(() {
    showErrorWidget = false;
    showEmptyWidget = false;
    showLoadingWidget = true;
  final response = await Dio()

  if (offset == 1) {

  List<PersonViewModel> receivedItems = [];

  receivedItems = (response.data as List)
        (final e) => PersonViewModel.fromJson(e as Map<String, dynamic>),


  setState(() {
    showLoadingWidget = false;
  if (receivedItems.length < limit) {
    _hasMoreData = false;

Define your refresh function that will be called when user pulls list down or when tapes on retry widget:

Future<void> _onRefresh() async {
      offset = 1;
      setState(() {
        showLoadingWidget = true;
        showErrorWidget = false;
        showEmptyWidget = false;

Additional information

for more info checkout github repository: https://github.com/aminJamali/advanced-list-view.git