ChannelListCore class
ChannelListCore is a simplified class that allows fetching a list of channels while exposing UI builders. A ChannelListController is used to reload and paginate data.
class ChannelListPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: ChannelListCore(
filter: Filter.in_(
'members',
[StreamChat.of(context).user!.id],
),
sort: [SortOption('last_message_at')],
pagination: PaginationParams(
limit: 20,
),
errorBuilder: (context, err) {
return Center(
child: Text('An error has occured'),
);
},
emptyBuilder: (context) {
return Center(
child: Text('Nothing here...'),
);
},
loadingBuilder: (context) {
return Center(
child: CircularProgressIndicator(),
);
},
listBuilder: (context, list) {
return ChannelPage(list);
}
),
);
}
}
Make sure to have a StreamChatCore ancestor in order to provide the information about the channels.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ChannelListCore
- Annotations
-
- @Deprecated(''' ChannelListCore is deprecated and will be removed in the next major version. Use StreamChannelListController instead to create your custom list. More details here https://getstream.io/chat/docs/sdk/flutter/stream_chat_flutter_core/stream_channel_list_controller ''')
Constructors
-
ChannelListCore({Key? key, required ErrorBuilder errorBuilder, required WidgetBuilder emptyBuilder, required WidgetBuilder loadingBuilder, required dynamic listBuilder(BuildContext, List<
Channel> ), Filter? filter, bool state = true, bool watch = true, bool presence = false, int? memberLimit, int? messageLimit, List<SortOption< ? sort, ChannelListController? channelListController, int limit = 25})ChannelModel> > -
Instantiate a new ChannelListView
const
Properties
- channelListController → ChannelListController?
-
A ChannelListController allows reloading and pagination.
Use ChannelListController.loadData and
ChannelListController.paginateData respectively for reloading and
pagination.
final
- emptyBuilder → WidgetBuilder
-
The builder used when the channel list is empty.
final
- errorBuilder → ErrorBuilder
-
The builder that will be used in case of error
final
- filter → Filter?
-
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.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- limit → int
-
The amount of channels requested per API call.
final
-
listBuilder
→ dynamic Function(BuildContext, List<
Channel> ) -
The builder which is used when list of channels loads
final
- loadingBuilder → WidgetBuilder
-
The builder that will be used in case of loading
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.
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.
final
- state → bool
-
If true returns the Channel state
final
- watch → bool
-
If true listen to changes to this Channel in real time.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → ChannelListCoreState -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited