AutoListCubit<T> class
A Cubit used to load a paginated list. You may want to use it in conjunction with AutoListView
- Inheritance
-
- Object
- BlocBase<
AutoListState< T> > - Cubit<
AutoListState< T> > - AutoListCubit
Constructors
-
AutoListCubit.new({required DataProvider<
T> provider}) - A DataProvider is a function returning a PaginatedList each time being called. By calling the DataProvider multiple times with a different page parameter, AutoListCubit may merge those PaginatedList and track the resulting one. If you want to listen to a stream of PaginatedList, see AutoListCubit.stream
-
AutoListCubit.stream({required StreamDataProvider<
T> provider}) - TODO
Properties
- baseProvider → dynamic
-
The initial provider set from the constructor
is either a DataProvider or a StreamDataProvider
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Whether the bloc is closed.
no setterinherited
- provider → dynamic
-
override this if you want to set a custom behavior to the internal provider.
For example, you may want to track an additional parameter unlike the base provider
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
→ AutoListState<
T> -
The current state.
no setterinherited
-
stream
→ Stream<
AutoListState< T> > -
The current stream of states.
no setterinherited
Methods
-
addError(
Object error, [StackTrace? stackTrace]) → void -
Reports an
error
which triggers onError with an optional StackTrace.inherited -
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
-
emit(
AutoListState< T> state) → void -
Updates the
state
to the providedstate
. emit does nothing if thestate
being emitted is equal to the currentstate
.inherited -
initialize(
) → void -
loadMore(
) → void - calls provider once again in other to obtain the next page of the PaginatedList. No action will be performed if the state meets one of the following:
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onChange(
Change< AutoListState< change) → voidT> > -
Called whenever a
change
occurs with the givenchange
. Achange
occurs when a newstate
is emitted. onChange is called before thestate
of thecubit
is updated. onChange is a great spot to add logging/analytics for a specificcubit
.inherited -
onError(
Object error, StackTrace stackTrace) → void -
Called whenever an
error
occurs and notifies BlocObserver.onError.inherited -
reset(
) → void - reloads the cubit to its initial state, using the current configuration
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited