cached_listview 1.0.0 copy "cached_listview: ^1.0.0" to clipboard
cached_listview: ^1.0.0 copied to clipboard

discontinuedreplaced by: flutter_cached
outdated

🧾 Flutter widget allowing easy cache-based data display in a ListView featuring pull-to-refresh and error banners.

cached_listview #

When building a screen that displays a cached list of items, there are many special cases to think about.

For example, on material.io, there are guidelines on how to handle displaying offline data and when to use error banners or empty states.

This package tries to make implementing cached ListViews as easy as possible.

[behavior diagram]

Usage #

First, create a CacheManager. This will be the class that orchestrates the fetching of data.

var cacheManager = CacheManager<Item>(
  // Does the actual work and returns a Future<List<Item>>.
  fetcher: _downloadData,
  // Asynchronously saves a List<Item> to the cache.
  saveToCache: _saveToCache,
  // Asynchronously loads a List<Item> from the cache.
  loadFromCache: _loadFromCache,
);

Then you can create a CachedListView in your widget tree:

CachedListView(
  manager: cacheManager,
  itemBuilder: (context, item) => ...,
  errorBannerBuilder: (context, error) => ...,
  errorScreenBuilder: (context, error) => ...,
  emptyStateBuilder: (context) => ...,
),
0
likes
0
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

🧾 Flutter widget allowing easy cache-based data display in a ListView featuring pull-to-refresh and error banners.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on cached_listview