Info:
This is documentation for Stream Chat Flutter SDK v4, which is no longer actively maintained. For up-to-date documentation, see the latest version (v10).

StreamChannelListEventHandler

A Class To Customize The Event Handler For The StreamChannelListController.

Find the pub.dev documentation here

Background

A StreamChannelListEventHandler is a class that handles the events that are related to the channel list loaded by StreamChannelListController. The StreamChannelListController automatically creates a StreamChannelListEventHandler internally and handles the events. In order to provide a custom implementation of StreamChannelListEventHandler, you need to create a class that extends the StreamChannelListEventHandler class.

Basic Example

There are 2 ways to provide a custom implementation of StreamChannelListEventHandler:

  • Create a class that extends the StreamChannelListEventHandler and pass it down to the controller.
class MyCustomEventHandler extends StreamChannelListEventHandler {
  @override
  void onConnectionRecovered(
    Event event,
    StreamChannelListController controller,
  ) {
    // Write your own custom implementation here
  }
}

Pass it down to the controller:

late final listController = StreamChannelListController(
    client: StreamChat.of(context).client,
    eventHandler: MyCustomEventHandler(),
  );
  • Mix the StreamChannelListEventHandler into your widget state.
class _ChannelListPageState extends State<ChannelListPage>
    with StreamChannelListEventHandler {

  @override
  void onConnectionRecovered(
    Event event,
    StreamChannelListController controller,
  ) {
    // Write your own custom implementation here
  }

  late final _listController = StreamChannelListController(
    client: StreamChat.of(context).client,
    eventHandler: this,
  );
}
Add Chat to my app: getstream.io/SKILL.md

The fastest way to build with Stream. Start a new project or improve an existing one. Full CLI and documentation integration out of the box.


Ask your agent:

/stream Build me a Social App with Feeds and Moderation.
/stream Any livestream calls running?
/stream Chat Flutter v4: <Your Question>