incrementally_loading_listview 0.3.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 94

incrementally_loading_listview #

pub package

An extension of the Flutter ListView widget for incrementally loading items upon scrolling. This could be used to load paginated data received from API requests.

NOTE: this package depends on rxdart. If you run into conflicts with different versions of rxdart, consider using dependency overrides as per this link

Getting Started #

There's a working example that can be run to see how it works.

First import the library

import 'package:incrementally_loading_listview/incrementally_loading_listview.dart';

You can then use the IncrementallyLoadingListView widget in a similar way you would with the ListView.builder constructor

return IncrementallyLoadingListView(
    hasMore: () => _hasMoreItems,
    itemCount: () => items.length,
    loadMore: () async {
    // can shorten to "loadMore: _loadMoreItems" but this syntax is used to demonstrate that
    // functions with parameters can also be invoked if needed
    await _loadMoreItems();
    loadMoreOffsetFromBottom: 2,
    itemBuilder: (context, index) {
        /// your builder function for rendering the item

The widget allows passing in the same parameters you would to the ListView.builder constructor but itemCount is required so that when an item scrolls into view, it can see if it should attempt to load more items. Note that this is a callback that returns a boolean rather than being a boolean value. This allows the widget to not require a reference/copy of your data collection. The other parameters that can be specified are

  • hasMore: a callback that indicates if there are more items that can be loaded
  • loadMore: a callback to an asynchronous function that loads more items
  • loadMoreOffsetFromBottom: determines when the list view should attempt to load more items based on of the index of the item is scrolling into view. This is relative to the bottom of the list and has a default value of 0 so that it loads when the last item within the list view scrolls into view. As an example, setting this to 1 would attempt to load more items when the second last item within the list view scrolls into view
  • onLoadMore: a callback that is triggered when more items are being loaded. At first this will pass a boolean value of true to when items are being loaded by triggering the loadMore callback function. You could use this to update your UI to show a loading indicator
  • onLoadMoreFinished: a callback that is triggered when items have finished being loading. You can use this to hide your loading indicator

Providing onLoadMore and onLoadMoreFinished callbacks means the widget doesn't make assumptions on how you want to render a loading indicator so it will be up to your application to handle these callbacks to render the appropriate UI.

[0.3.0] 11/1/2020

  • BREAKING CHANGE Updated rxdart dependency
  • Bump minimum Flutter version to 1.12
  • Update pedantic dependency
  • Recreate example app with minor refactoring
  • Updated example to use shimmer package when showing placeholder item card that is displayed when loading more items

[0.2.0+2] 28/9/2019

  • Add pub badge to readme

[0.2.0+1] 14/8/2019

  • Update email address in pubspec.yaml

[0.2.0] 10/6/2019

  • BREAKING CHANGE Updated rxdart dependency

[0.1.0+1] 27/3/2019

  • No functional changes in this release. Changes were to fix formatting to meet Dart guidelines

[0.1.0] - 25/2/2019

  • BREAKING CHANGE Updated rxdart dependency
  • Formatted README. Thanks to PR from Mohammed Salman

[0.0.4+3] - 15/8/2018

  • Reordering changelog

[0.0.4+2] - 15/8/2018

  • BREAKING CHANGE separated onLoadMore callback. There is now an onLoadMore that doesn't pass a boolean and is triggered when more items are being loaded and onLoadMoreFinished when more items have finished being loaded.
  • Updated README to explain onLoadMore and onLoadMoreFinished

[0.0.4+1] - 15/8/2018

  • Updated README

[0.0.4] - 15/8/2018

  • BREAKING CHANGES fixed an issue that occurred where package no longer worked due to the way the list view was triggering the loading of more items. This was due to the fact that setState was being called while the build was occurred. Changed this now to use a StreamBuilder wrapped around a ListView.builder now so that upon reaching the nth item from the bottom will emit an item onto a stream that executes the function required to load more items and rebuild the ListView when the functions completes execution. As a result of these changes itemCount and hasMore are now callbacks
  • Updated sample to add navigating to an item details page for testing

[0.0.3] - 23/7/2018

  • Corrected some bad grammar in the README due to late night blogging/coding...

[0.0.2] - 21/7/2018

  • Updated license

[0.0.1] - 21/7/2018

  • Initial release


incrementally_loading_listview_example #

Demonstrates how to use the incrementally_loading_listview plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  incrementally_loading_listview: ^0.3.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:incrementally_loading_listview/incrementally_loading_listview.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
rxdart ^0.23.0 0.23.1
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
pedantic ^1.8.0