list_smith library
A developer-first ListView.builder wrapper for async pagination and
pull-to-refresh.
Classes
- AdvanceToFirstNonEmpty
- Pages past empty pages to the first page that has items, or the true end.
- AsyncListSurfaces
- Groups the overridable surfaces that only an async list has, so ListSmith.async's behavioural parameters aren't buried among a run of optional builders.
-
AsyncSearch<
T extends Object> - Async search on: a non-empty query switches the list to a search view fetched by fetchPage.
- EmptyPageBehaviour
- What an async list does when a page settles with no items but PaginationEndPolicy reports that more pages remain.
- EmptyPageContext
- The facts an EmptyPageBehaviour sees when deciding whether to page past an empty page.
- EndContext
- The data a PaginationEndPolicy sees when deciding whether an async list has reached its end.
- ExplicitHasMorePolicy
- Ends pagination as soon as a page's fetcher reports there is no more data.
- FixedPageCountPolicy
- Ends pagination after a fixed number of pages, pageCount, whatever those pages contain.
-
Grouping<
T extends Object> - How a list_smith list splits its items into labelled sections.
- KeepCachePolicy
- Preserves the normal-mode list across a search: its paging state is snapshotted on entering search and restored when the query is cleared, so returning is instant with no refetch.
- ListScrollConfig
- Groups the scroll and layout knobs for a list_smith list, so behavioural parameters don't share the constructor signature with the scrollable's own configuration.
-
ListSmith<
T extends Object> - A developer-first list handling async pagination and pull-to-refresh, or sync in-memory search.
- ListSmithObserver
- Lifecycle observer for a ListSmith.async list: an optional, injected sink for logging, telemetry, or analytics.
- ListSmithRefreshState
- The state of list_smith's pull-to-refresh at build time, handed to a RefreshBuilder.
- LoggingListSmithObserver
-
A ListSmithObserver that logs every event to developer.log under the
list_smithname. -
NoGrouping<
T extends Object> - The absence of grouping: the list renders as a flat sequence with no section headers.
- NoRefresh
- Pull-to-refresh off: the list wires no refresh gesture and draws no refresh indicator.
- NoSearch
- No async search: the list is a plain paginated feed, with no search mode.
-
PageFetcher<
T extends Object> - Fetches one page of items for an async list.
- PaginationEndPolicy
- Decides when an async list has reached the end of its data.
- PullToRefresh
- Pull-to-refresh on (the default): a downward pull past the threshold reloads the list (from the first page by default; see reload).
- Refresh
- Whether an async list has pull-to-refresh, and how its indicator is drawn.
- Reload
- What pull-to-refresh does to the pages already loaded.
- ReloadToCurrentDepth
- Re-fetches every currently-loaded page so a pull-to-refresh keeps the user's scroll depth instead of snapping back to the first page.
- ReplaceCachePolicy
- Starts every mode clean: entering search, leaving search, and each change of search query all refetch from page 0.
- ResetToFirstPage
- Discards every loaded page and reloads only the first, the underlying pager's own refresh and the default. A pull returns the list to the top with fresh data.
-
Search<
T extends Object> - Whether an async list is searchable, and how search behaves.
- SearchCachePolicy
- Decides how an async list's cached items carry across a normal ↔ search mode change.
-
SearchPageFetcher<
T extends Object> - Fetches one page of search results for an async list, for a given query.
- ShowEmptySurface
- Shows the empty surface as soon as a page settles with no items, fetching no further.
- StopOnEmptyPagesPolicy
- Ends pagination after emptyRunBeforeEnd consecutive empty pages.
- StopOnNullSignalPolicy
-
Ends pagination when a page's fetcher reports a
nullend signal, after at least one page. - SyncSearchPredicates
- Ready-made SyncSearchPredicate builders for the common sync-search cases.
Enums
- ListSmithRefreshPhase
- The phase of a pull-to-refresh gesture, as handed to a RefreshBuilder.
- ReloadOnError
- How a ReloadToCurrentDepth reload settles when a page-fetch fails (after the fetcher's own retries).
Typedefs
- ErrorBuilder = Widget Function(BuildContext context, Object error, VoidCallback onRetry)
- Builds an error surface for a page that failed to load.
-
GroupHeaderBuilder<
K extends Object> = Widget Function(BuildContext context, K key) -
Builds the section header shown above the first item of a group, given that group's
key. -
GroupKeyOf<
T extends Object, K extends Object> = K Function(T item) -
Extracts the group key for
item, for a list_smith list that shows its items in sections. -
ItemBuilder<
T extends Object> = Widget Function(BuildContext context, T item, int index) - Builds the widget for a single list item.
-
ItemId<
T extends Object> = Object Function(T item) - Extracts a stable identity key from an item, for de-duplicating paginated results.
- NoResultsBuilder = Widget Function(BuildContext context, String query)
-
Builds the surface shown when a search runs but matches nothing, carrying the
querythat found no results (parallel to howErrorBuildercarries its error). - RefreshBuilder = Widget Function(BuildContext context, Widget child, ListSmithRefreshState state)
-
Draws a custom pull-to-refresh indicator around the scrollable
child, usingstate. -
SyncSearchPredicate<
T extends Object> = bool Function(T item, String query) - Decides whether an item matches a search query, for a sync (in-memory) list_smith list.