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
- The overridable surfaces only an async list has: page loading, page errors, the end-of-list footer.
-
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 says more pages remain. Nothing on screen means nothing to scroll, so the pager's scroll-driven fetch never fires and the pages that do hold data stay out of reach.
- 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
hasMore: false. - FailOnUnorderedPolicy
- Throws a StateError when pages arrive out of group order, in release too.
- FixedPageCountPolicy
- Ends pagination after pageCount pages, whatever those pages contain.
-
Grouping<
T extends Object> - How a list_smith list splits its items into labelled sections.
- GroupOrderPolicy
- What an async list does when its pages do not arrive grouped by key.
- KeepCachePolicy
- Keeps the normal-mode list across a search: snapshotted on the way in, restored when the query clears, so coming back is instant with no refetch.
- ListScrollConfig
- The scroll and layout knobs, gathered here so they don't crowd the behavioural parameters.
-
ListSmith<
T extends Object> - A developer-first list handling async pagination and pull-to-refresh, or sync in-memory search.
- ListSmithController
- A narrow handle for driving a ListSmith.async list from code: a refresh button, a tab re-tap, a re-read after a local write, a logout.
- 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, given the PageRequest describing it.
- PageRequest
- The inputs of one page fetch, handed to a PageFetcher as a single value. Built per fetch, read-only for a consumer.
- 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.
- RepairHeadersPolicy
- Draws each group's header once, where the group first shows up. The default.
- ReplaceCachePolicy
- Starts every mode clean: entering search, leaving it and each new 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 entering or leaving search.
-
SearchPageFetcher<
T extends Object> - Fetches one page of search results for an async list, given the SearchPageRequest describing it.
- SearchPageRequest
- The inputs of one search-page fetch, handed to a SearchPageFetcher.
- ShowEmptySurface
- Shows the empty surface as soon as a page settles with no items, fetching no further. The default.
- StopOnEmptyPagesPolicy
- Ends pagination after emptyRunBeforeEnd consecutive empty pages.
- StopOnNullSignalPolicy
-
Ends pagination when a page's fetcher returns a
nullend signal, after at least one page. - SyncSearchPredicates
- Ready-made SyncSearchPredicate builders for the usual sync-search shapes, built from a list of field extractors.
Enums
- FetchTrigger
- Why list_smith asked for a page, carried on every PageRequest.
- 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, given the
itemand itsindexin the flattened list. -
ItemId<
T extends Object> = Object Function(T item) - Extracts a stable identity key from an item, for de-duplicating overlapping pages.
- NoResultsBuilder = Widget Function(BuildContext context, String query)
-
Builds the surface shown when a search matches nothing, carrying the
querythat found none. - 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.