IPaginationListCubit<T, StateType extends IPaginationState<T> > class
abstract
Base interface for pagination cubits with list building capabilities.
- Inheritance
-
- Object
- IPaginationCubit<
T, StateType> - IPaginationListCubit
- Implementers
Constructors
- IPaginationListCubit(StateType initialState)
Properties
-
currentItems
→ List<
T> -
Returns the current list of items, or empty list if not loaded.
no setter
- didFetch → bool
-
Whether the cubit has fetched data at least once.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialRequest → PaginationRequest
-
Initial request configuration used when the pagination starts.
no setterinherited
- isClosed → bool
-
Whether the bloc is closed.
no setterinherited
-
listBuilder
→ ListBuilder<
T> ? -
Optional hook to transform or sort items before emitting.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → StateType
-
The current state.
no setterinherited
-
stream
→ Stream<
StateType> -
The current stream of states.
no setterinherited
Methods
-
addError(
Object error, [StackTrace? stackTrace]) → void -
Reports an
errorwhich triggersonErrorwith an optional StackTrace.inherited -
addOrUpdateEmit(
T item, {int index = 0}) → void - Adds or updates an item in the list.
-
cancelOngoingRequest(
) → void -
Cancels any inflight work.
inherited
-
clearItems(
) → void - Clears all items from the list.
-
close(
) → Future< void> -
Closes the instance.
This method should be called when the instance is no longer needed.
Once
closeis called, the instance can no longer be used.inherited -
dispose(
) → void -
Disposes the cubit and its resources.
inherited
-
emit(
StateType state) → void -
Updates the
stateto the providedstate.emitdoes nothing if thestatebeing emitted is equal to the currentstate.inherited -
fetchPaginatedList(
{PaginationRequest? requestOverride, int? limit}) → void -
Fetches the next page of the paginated list.
inherited
-
filterPaginatedList(
WhereChecker< T> ? searchTerm) → void -
Filters the paginated list based on the provided search term.
inherited
-
insertAllEmit(
List< T> items, {int index = 0}) → void - Inserts multiple items at the specified index.
-
insertEmit(
T item, {int index = 0}) → void - Inserts an item at the specified index.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onChange(
Change< StateType> change) → void -
Called whenever a
changeoccurs with the givenchange. Achangeoccurs when a newstateis emitted.onChangeis called before thestateof thecubitis updated.onChangeis a great spot to add logging/analytics for a specificcubit.inherited -
onError(
Object error, StackTrace stackTrace) → void -
Called whenever an
erroroccurs and notifiesBlocObserver.onError.inherited -
refreshPaginatedList(
{PaginationRequest? requestOverride, int? limit}) → void -
Refreshes the paginated list, starting from the beginning.
inherited
-
reload(
) → void - Reloads the list from the beginning (alias for refreshPaginatedList).
-
removeAtEmit(
int index) → T? - Removes an item at the specified index. Returns the removed item, or null if index is out of bounds.
-
removeItemEmit(
T item) → bool - Removes an item from the list. Returns true if the item was found and removed.
-
removeWhereEmit(
bool test(T item)) → int - Removes all items that match the predicate. Returns the number of items removed.
-
setItems(
List< T> items) → void - Sets the list to a completely new set of items.
-
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.
-
updateWhereEmit(
bool matcher(T item), T updater(T item)) → int - Updates all items that match the predicate. Returns the number of items updated.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited