ChatListController<T> class
A controller for a ChatList widget. It is used to manage the items of the list and to notify the list when changes occur.
{@tool snippet}
The following example demonstrates how to create a ChatListController and initialize it with a list of integers.
late final ChatListController<int> _chatListController = ChatListController<int>(
initialItems: List<int>.generate(10, (index) => index),
);
{@end-tool}
- Inheritance
-
- Object
- ChangeNotifier
- ChatListController
Constructors
-
ChatListController({required List<
T> initialItems})
Properties
- didLoadAll → bool
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- itemsCount → int
-
no setter
- lastAddedToBottom → bool
-
no setter
- newest → T?
-
no setter
-
newItems
→ List<
T> -
no setter
- oldest → T?
-
no setter
-
oldItems
→ List<
T> -
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shouldJumpToBottom → bool
-
no setter
- shouldScrollToBottom → bool
-
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addRangeToBottom(
List< T> items) → void - Adds a range of items to the bottom of the list.
-
addRangeToTop(
List< T> items) → void - Adds a range of items to the top of the list.
-
addToBottom(
T item) → void - Adds an item to the bottom of the list.
-
addToTop(
T item) → void - Adds an item to the top of the list.
-
clearAll(
) → void - Clears all items and resets the controller to its initial state.
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
jumpToBottom(
) → void - Jumps to the bottom of the list. (Experimental feature - not in a single jump)
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
replaceFirstItemWhere(
{required bool test(T item), required T newItem}) → bool -
Replaces first item that matches the
testwith anewItem. -
replaceItem(
{required T oldItem, required T newItem}) → bool -
Replaces first
oldItemoccurrence with anewItem. -
scrollToBottom(
) → void - Scrolls to the bottom of the list. (Experimental feature - no smooth animation)
-
setDidLoadAll(
bool value) → void -
Sets the value of
_didLoadAll. If set to true, the load more callback will not be called anymore. This is used automatically and should not be called manually unless for specific use cases. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited