SmartPaginationCubit<T> class
Methods
-
addError(Object error, [StackTrace? stackTrace])
→ void
-
Reports an
error which triggers onError with an optional StackTrace.
inherited
-
addOrUpdateEmit(T item, {int index = 0})
→ void
-
Adds or updates an item in the list.
override
-
addSortOrder(SortOrder<T> order)
→ void
-
Adds a new sort order to the collection.
-
cancelOngoingRequest()
→ void
-
Cancels any inflight work.
override
-
checkAndResetIfExpired()
→ bool
-
Checks if data has expired and resets the cubit if so.
Returns true if the data was expired and reset was triggered.
This is useful when using the cubit as a global variable and
re-entering a screen after some time.
-
clearItems()
→ void
-
Clears all items from the list.
override
-
clearOrder()
→ void
-
Clears the active sort order (items will be in their original order).
-
close()
→ Future<void>
-
Closes the instance.
This method should be called when the instance is no longer needed.
Once
close is called, the instance can no longer be used.
inherited
-
dispose()
→ void
-
Disposes the cubit and its resources.
override
-
emit(SmartPaginationState<T> state)
→ void
-
Updates the
state to the provided state.
emit does nothing if the state being emitted
is equal to the current state.
inherited
-
fetchPaginatedList({PaginationRequest? requestOverride, int? limit})
→ void
-
Fetches the next page of the paginated list.
override
-
filterPaginatedList(WhereChecker<T>? searchTerm)
→ void
-
Filters the paginated list based on the provided search term.
override
-
insertAllEmit(List<T> items, {int index = 0})
→ void
-
Inserts multiple items at the specified index.
override
-
insertEmit(T item, {int index = 0})
→ void
-
Inserts an item at the specified index.
override
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
onChange(Change<SmartPaginationState<T>> change)
→ void
-
Called whenever a
change occurs with the given change.
A change occurs when a new state is emitted.
onChange is called before the state of the cubit is updated.
onChange is a great spot to add logging/analytics for a specific cubit.
inherited
-
onError(Object error, StackTrace stackTrace)
→ void
-
Called whenever an
error occurs and notifies BlocObserver.onError.
inherited
-
refreshPaginatedList({PaginationRequest? requestOverride, int? limit})
→ void
-
Refreshes the paginated list, starting from the beginning.
override
-
reload()
→ void
-
Reloads the list from the beginning (alias for refreshPaginatedList).
override
-
removeAtEmit(int index)
→ T?
-
Removes an item at the specified index.
Returns the removed item, or null if index is out of bounds.
override
-
removeItemEmit(T item)
→ bool
-
Removes an item from the list.
Returns true if the item was found and removed.
override
-
removeSortOrder(String orderId)
→ bool
-
Removes a sort order from the collection.
-
removeWhereEmit(bool test(T item))
→ int
-
Removes all items that match the predicate.
Returns the number of items removed.
override
-
resetOrder()
→ void
-
Resets to the default sort order and re-sorts the current items.
-
setActiveOrder(String orderId)
→ bool
-
Sets the active sort order by ID and re-sorts the current items.
-
setItems(List<T> items)
→ void
-
Sets the list to a completely new set of items.
override
-
setOrders(SortOrderCollection<T>? orders)
→ void
-
Sets the sort order collection.
-
sortBy(ItemComparator<T> comparator)
→ void
-
Sorts items using a one-time comparator without changing the active order.
-
toString()
→ String
-
A string representation of this object.
inherited
-
updateItemEmit(bool matcher(T item), T updater(T item))
→ bool
-
Updates an item in the list using a matcher and updater function.
Returns true if an item was found and updated.
override
-
updateWhereEmit(bool matcher(T item), T updater(T item))
→ int
-
Updates all items that match the predicate.
Returns the number of items updated.
override