StreamChannelListController class
A controller for a Channel list.
This class lets you perform tasks such as:
- Load initial data.
- Use channel events handlers.
- Load more data using loadMore.
- Replace the previously loaded channels.
- Return/Create a new channel and start watching it.
- Pause and Resume all subscriptions added to this composite.
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
PagedValue< int, Channel> > - PagedValueNotifier<
int, Channel> - StreamChannelListController
Constructors
-
StreamChannelListController({required StreamChatClient client, StreamChannelListEventHandler? eventHandler, Filter? filter, @Deprecated('''
sort has been deprecated.
Please use channelStateSort instead.''') List<
SortOption< ? sort, List<ChannelModel> >SortOption< ? channelStateSort, bool presence = true, int limit = defaultChannelPagedLimit, int? messageLimit, int? memberLimit})ChannelState> > - Creates a Stream channel list controller.
-
StreamChannelListController.fromValue(PagedValue<
int, Channel> value, {required StreamChatClient client, StreamChannelListEventHandler? eventHandler, Filter? filter, List<SortOption< ? channelStateSort, @Deprecated(''' sort has been deprecated. Please use channelStateSort instead.''') List<ChannelState> >SortOption< ? sort, bool presence = true, int limit = defaultChannelPagedLimit, int? messageLimit, int? memberLimit})ChannelModel> > -
Creates a StreamChannelListController from the passed
value
.
Properties
-
channels
← List<
Channel> -
Replaces the previously loaded channels with the passed
channels
.no getter -
channelStateSort
→ List<
SortOption< ?ChannelState> > -
The sorting used for the channels matching the filters.
final
- client → StreamChatClient
-
The client to use for the channels list.
final
-
currentItems
→ List<
Channel> -
Returns the currently loaded items
no setterinherited
- eventListener ↔ bool Function(Event event)?
-
Event listener, which can be set in order to listen
client web-socket events.
getter/setter pair
- filter → Filter?
-
The query filters to use.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- limit → int
-
The limit to apply to the channel list. The default is set to
defaultChannelPagedLimit.
final
- memberLimit → int?
-
Number of members to fetch in each channel.
final
- messageLimit → int?
-
Number of messages to fetch in each channel.
final
- presence → bool
-
If true you’ll receive user presence updates via the websocket events
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sort
→ List<
SortOption< ?ChannelModel> > -
The sorting used for the channels matching the filters.
final
-
value
↔ PagedValue<
int, Channel> -
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
appendLastPage(
List< Channel> newItems) → void -
Appends
newItems
to the previously loaded ones and sets the next page key tonull
.inherited -
appendPage(
{required List< Channel> newItems, required int nextPageKey}) → void -
Appends
newItems
to the previously loaded ones and replaces the next page's key.inherited -
deleteChannel(
Channel channel) → Future< void> -
Deletes the
channel
and updates the list. -
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).
override
-
doInitialLoad(
) → Future< void> -
Load initial data from the server.
override
-
getChannel(
{required String id, required String type}) → Future< Channel> - Returns/Creates a new Channel and starts watching it.
-
leaveChannel(
Channel channel) → Future< void> -
Leaves the
channel
and updates the list. -
loadMore(
int nextPageKey) → Future< void> -
Load more data from the server using
nextPageKey
.override -
muteChannel(
Channel channel) → Future< void> -
Mutes the
channel
and updates the list. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
pauseEventsSubscription(
[Future< void> ? resumeSignal]) → void - Pauses all subscriptions added to this composite.
-
refresh(
{bool resetValue = true}) → Future< void> -
Refresh the data presented by this PagedValueNotifier.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resumeEventsSubscription(
) → void - Resumes all subscriptions added to this composite.
-
retry(
) → Future< void> -
Retry any failed load requests.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
unmuteChannel(
Channel channel) → Future< void> -
Un-mutes the
channel
and updates the list.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited