ResourceListProvider class
Owns one resource's list: records, search term, active sort, pagination.
Debouncing lives in the screen, not here — a provider owning a timer is untestable without pumping fake async, and the screen is where the keystroke actually arrives.
- Inheritance
-
- Object
- ChangeNotifier
- ResourceListProvider
Constructors
- ResourceListProvider({required ResourceDataSource source, required ResourceSchema resource})
Properties
- activeFilterCount → int
-
Counts every entry in filters, INCLUDING a filter node's seeded
defaultthat the user has not touched — so a resource with two defaulted filters reports2from the very first frame, before any interaction. This is deliberate, not a side effect of_seedFilters: Filament's own web panel shows an indicator chip for a defaulted filter too, so this is parity with it, and a default the user cannot see applied is worse than a badge counting one they didn't set themselves. Task 5's filter-count badge should read this as-is rather than trying to subtract seeded defaults back out.no setter - activeSort → ResourceSort?
-
no setter
- errorMessage → String?
-
no setter
-
filters
→ Map<
String, Object?> -
name =>
String|List<String>— a SNAPSHOT copy at the moment of the call, not a live view: both setFilter and clearFilters reassign the backing map rather than mutate it in place, so a previously-returned value never reflects a later change. Re-read this getter after notifyListeners fires (a listening widget already does, on every rebuild) rather than holding onto one call's result.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- hasMore → bool
-
no setter
- isLoadingMore → bool
-
no setter
- isReordering → bool
-
True while a drag-to-reorder session (P18) is open — see
enterReorderMode.
no setter
- isSavingReorder → bool
-
True while saveReorder's POST is in flight.
no setter
- isUnauthenticated → bool
-
True when the load failed on a 401 — see FilamentTransportException.statusCode.
no setter
- loadMoreFailed → bool
-
no setter
-
records
→ List<
ResourceRecord> -
no setter
-
reorderedRecords
→ List<
ResourceRecord> -
The full, unpaginated list in its current drag order. Only meaningful
while isReordering — empty otherwise.
no setter
- resource → ResourceSchema
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchTerm → String
-
no setter
- source → ResourceDataSource
-
final
- status → LoadStatus
-
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
clearFilters(
) → Future< void> -
Clears EVERY filter this resource's schema publishes — including ones
never touched and ones with no seeded default — to the explicit
''"any" value, and refetches: the reorder-ordered page instead while isReordering. Same reasoning as setFilter: writing''for every published filter name (rather than emptying the map) is what stops the server from reinstating any of their defaults on the next request. -
dispose(
) → void -
Discards any resources used by the object.
inherited
-
enterReorderMode(
) → Future< void> -
Opens a drag-to-reorder session (P18): fetches the FULL, unpaginated
list ordered by the resource's declared reorder column
(
source.list(reorder: true)), never the paginated rows already on screen — a drag has to be able to place a record anywhere in the whole set, not just within whichever page happened to be loaded. Sends the list's current searchTerm along — a term already active on the paginated list stays active once reorder mode opens, same as Filament. -
exitReorderMode(
) → void - Abandons the drag session with no write: restores the last server-confirmed order and closes reorder mode.
-
load(
) → Future< void> -
loadMore(
) → Future< void> - Appends the next page. A failure here keeps whatever is already on screen — losing a scrolled list because page four timed out is worse than the missing page — but loadMoreFailed still flips, so the trailing row can show a retry instead of a spinner that never resolves into anything the user is told about.
-
moveRecord(
int oldIndex, int newIndex) → void -
Moves one record from
oldIndextonewIndexwithin reorderedRecords, purely locally — no network call. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
refresh(
{bool keepPrevious = false}) → Future< void> -
Refetches page one.
keepPreviousis used by background polling so an unchanged or transiently-failed refresh never flashes a skeleton over a list the user was already reading. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
saveReorder(
) → Future< void> -
Commits the current drag order:
POST {resource}/reorderwith every record CURRENTLY VISIBLE's id, first entry first — the searched subset when a search term is active, same as_fetchReorderedPagefetched. This matches Filament's own reorder-while-filtered behavior: the server renumbers only the posted ids 1..N among themselves, leaving records outside the filter wherever they already were. -
search(
String term) → Future< void> -
While isReordering, this refetches the reorder-ordered list WITH the
term (
?reorder=1&search=...) instead of the hidden paginated list — Filament keeps its own search filter active while reordering, and a search box that visibly renders but only ever touches the paginated list underneath reorderedRecords would be exactly the silent no-op this screen's own class doc argues against. -
searchFilterOptions(
String filter, String query) → Future< OptionsPage> - Searches one filter's remote options through an optional source capability. Existing custom ResourceDataSource implementations remain source-compatible; opening a remote filter on one reports a real error state instead of pretending the server returned no matches.
-
setFilter(
String name, Object? value) → Future< void> - Sets or clears one filter (P24) and refetches page one — the reorder-ordered page instead, while isReordering, same as search.
-
sortBy(
ResourceSort sort) → Future< void> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited