diff --git a/packages/stream_chat_flutter_core/lib/src/message_search_list_core.dart b/packages/stream_chat_flutter_core/lib/src/message_search_list_core.dart index 636a879fa..d354daec8 100644 --- a/packages/stream_chat_flutter_core/lib/src/message_search_list_core.dart +++ b/packages/stream_chat_flutter_core/lib/src/message_search_list_core.dart @@ -120,8 +120,10 @@ class MessageSearchListCoreState extends State { } void _setupController() { - widget.messageSearchListController!.loadData = loadData; - widget.messageSearchListController!.paginateData = paginateData; + if (widget.messageSearchListController != null) { + widget.messageSearchListController!.loadData = loadData; + widget.messageSearchListController!.paginateData = paginateData; + } } @override diff --git a/packages/stream_chat_flutter_core/lib/src/user_list_core.dart b/packages/stream_chat_flutter_core/lib/src/user_list_core.dart index 05a8432da..db6b3586c 100644 --- a/packages/stream_chat_flutter_core/lib/src/user_list_core.dart +++ b/packages/stream_chat_flutter_core/lib/src/user_list_core.dart @@ -139,8 +139,10 @@ class UserListCoreState extends State } void _setupController() { - widget.userListController!.loadData = loadData; - widget.userListController!.paginateData = paginateData; + if (widget.userListController != null) { + widget.userListController!.loadData = loadData; + widget.userListController!.paginateData = paginateData; + } } @override