ChannelListView class

screenshot screenshot

It shows the list of current channels.

class ChannelListPage extends StatelessWidget {
  Widget build(BuildContext context) {
    return Scaffold(
      body: ChannelListView(
        filter: {
          'members': {
            '\$in': [StreamChat.of(context)],
        sort: [SortOption('last_message_at')],
        pagination: PaginationParams(
          limit: 20,
        channelWidget: ChannelPage(),

Make sure to have a StreamChat ancestor in order to provide the information about the channels. The widget uses a ListView.custom to render the list of channels.

The widget components render the ui based on the first ancestor of type StreamChatTheme. Modify it to change the widget appearance.


ChannelListView({Key key, Map<String, dynamic> filter, Map<String, dynamic> options, List<SortOption> sort, PaginationParams pagination, ChannelTapCallback onChannelTap, dynamic onChannelLongPress(Channel), Widget channelWidget, ChannelPreviewBuilder channelPreviewBuilder, dynamic separatorBuilder(BuildContext, int), Widget errorBuilder(Error error), WidgetBuilder emptyBuilder, dynamic onImageTap(Channel), WidgetBuilder loadingBuilder, bool pullToRefresh = true})
Instantiate a new ChannelListView


channelPreviewBuilder ChannelPreviewBuilder
Builder used to create a custom channel preview
channelWidget → Widget
Widget used when opening a channel
emptyBuilder → WidgetBuilder
The builder used when the channel list is empty.
errorBuilder → Widget Function(Error error)
The builder that will be used in case of error
filter → Map<String, dynamic>
The query filters to use. You can query on any of the custom fields you've defined on the Channel. You can also filter other built-in channel fields.
hashCode → int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
key → Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
loadingBuilder → WidgetBuilder
The builder used while loading.
onChannelLongPress → dynamic Function(Channel)
Function called when long pressing on a channel
onChannelTap ChannelTapCallback
Function called when tapping on a channel By default it calls Navigator.push building a MaterialPageRoute with the widget channelWidget as child.
onImageTap → dynamic Function(Channel)
The function called when the image is tapped
options → Map<String, dynamic>
Query channels options. [...]
pagination PaginationParams
Pagination parameters limit: the number of channels to return (max is 30) offset: the offset (max is 1000) message_limit: how many messages should be included to each channel
pullToRefresh → bool
Set it to false to disable the pull-to-refresh widget
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited
separatorBuilder → dynamic Function(BuildContext, int)
Builder used to create a custom item separator
sort → List<SortOption>
The sorting used for the channels matching the filters. Sorting is based on field and direction, multiple sorting options can be provided. You can sort based on last_updated, last_message_at, updated_at, created_at or member_count. Direction can be ascending or descending.


createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
createState() → _ChannelListViewState
Creates the mutable state for this widget at a given location in the tree. [...]
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toDiagnosticsNode({String name, DiagnosticsTreeStyle style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
toString({DiagnosticLevel minLevel =}) → String
Returns a string representation of this object.
toStringDeep({String prefixLineOne = '', String prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a string representation of this node and its descendants. [...]
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object. [...]
toStringShort() → String
A short, textual description of this widget.


operator ==(Object other) → bool
The equality operator. [...]
@nonVirtual, inherited