---
id: channel_list_core
sidebar_position: 4
title: ChannelListCore
---

A Widget For Building A List Of Channels

### Background

The UI SDK of Stream Chat supplies a `ChannelListView` class that builds a list of channels fetching
according to the filters and sort order given. However, in some cases, implementing novel UI is necessary
that cannot be done using the customization approaches given in the widget.

To do this, we extracted the logic required for fetching channels into a 'Core' widget - a widget that
fetches channels in the expected way via the usual params but does not supply any UI and instead
exposes builders to build the UI in situations such as loading, empty data, errors, and on data received.

### Basic Example

`ChannelListCore` is a simplified class that allows fetching a list of
channels while exposing UI builders.

This allows you to construct your own UI while not having to
worry about the specific logic of fetching channels in your app.

A `ChannelListController` is used to reload and paginate data.

```dart
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.