dependencies:
stream_chat_flutter: ^7.0.0 # full UI, core and client packages
stream_chat: ^7.0.0 # client packagev7.0
This guide enumerates and better explains the SDK changes introduced in v7.
If you find any bugs or have any questions, please file an issue on our GitHub repository. We want to support you as much as we can with this migration.
Code examples:
- See our Stream Chat Flutter tutorial for an up-to-date guide using the latest Stream Chat version.
- See the Stream Flutter Samples repository with our full fledged messaging sample application.
Our documentation has also been updated to support v7, so all guides and examples will have updated code.
Dependencies
To migrate to v7.0.0, update your pubspec.yaml with the correct Stream chat package you’re using:
What’s New?
We improved the overall user experience of the Stream Chat Flutter SDK and added new features to make it easier to customize the SDK to your needs.
We’ve also fixed several bugs and improved the overall stability of the SDK.
Added support for StreamMessageInput.contentInsertionConfiguration to specify the content insertion configuration.
StreamMessageInput(
...,
contentInsertionConfiguration: ContentInsertionConfiguration(
onContentInserted: (content) {
// Do something with the content.
controller.addAttachment(...);
},
),
)Breaking changes
The following components have been removed in v7.0.0:
ChatPersistenceClient.getChannelStates.sorthas been removed in favor ofChatPersistenceClient.getChannelStates.channelStateSort.
/// BEFORE
chatPersistenceClient.getChannelStates(
...
sort: [SortOption('last_message_at')],
)
/// AFTER
chatPersistenceClient.getChannelStates(
...
channelStateSort: [SortOption('last_message_at')],
)StreamChatClient.queryChannels.sorthas been removed in favor ofStreamChatClient.queryChannels.channelStateSort.
/// BEFORE
streamChatClient.getChannelStates(
...
sort: [SortOption('last_message_at')],
)
/// AFTER
streamChatClient.getChannelStates(
...
channelStateSort: [SortOption('last_message_at')],
)MessageWidget.customAttachmentBuildershas been removed in favor ofMessageWidget.attachmentBuilders.
/// BEFORE
MessageWidget(
customAttachmentBuilders: {
'image': (context, message, attachment) => // build image attachment,
},
...
)/// AFTER
class CustomImageAttachmentBuilder extends StreamAttachmentWidgetBuilder {
@override
bool canHandle(
Message message,
Map<String, List<Attachment>> attachments,
) {
// Custom logic to check
// if the attachment can be handled by this builder
...
}
@override
Widget build(
BuildContext context,
Message message,
Map<String, List<Attachment>> attachments,
) {
// custom build implementation
...
}
}
MessageWidget(
attachmentBuilders: const [CustomImageAttachmentBuilder()],
...
)RetryPolicy.retryTimeouthas been removed in favor ofRetryPolicy.delayFactor.StreamChatNetworkError.fromDioErrorhas been removed in favor ofStreamChatNetworkError.fromDioException.MessageSendingStatushas been removed in favor ofMessageState.StreamChannelListController.sorthas been removed in favor ofStreamChannelListController.channelStateSort.ChannelPreviewhas been removed in favor ofStreamChannelListTile.ChannelPreviewBuilderhas been removed in favor ofStreamChannelListViewIndexedWidgetBuilder.StreamUserItemhas been removed in favor ofStreamUserListTile.ReturnActionTypehas been removed and no longer used.StreamMessageInput.attachmentThumbnailBuildershas been removed in favor ofStreamMessageInput.mediaAttachmentBuilder.MessageWidget.showReactionPickerIndicatorhas been removed in favor ofMessageWidget.showReactionPicker.MessageWidget.bottomRowBuilderhas been removed in favor ofMessageWidget.bottomRowBuilderWithDefaultWidget.MessageWidget.deletedBottomRowBuilderhas been removed in favor ofMessageWidget.deletedBottomRowBuilderWithDefaultWidget.MessageWidget.usernameBuilderhas been removed in favor ofMessageWidget.usernameBuilderWithDefaultWidget.MessageWidget.showReactionPickerTailhas been removed in favor ofMessageWidget.showReactionPicker.MessageTheme.linkBackgroundColorhas been removed in favor ofMessageTheme.urlAttachmentBackgroundColor.showConfirmationDialoghas been removed in favor ofshowConfirmationBottomSheet.showInfoDialoghas been removed in favor ofshowInfoBottomSheet.wrapAttachmentWidgethas been removed in favor ofWrapAttachmentWidget.MessageListView.onMessageSwipedparameter. Try wrapping theMessageWidgetwith aSwipeable,Dismissibleor a custom widget to achieve the swipe to reply behaviour.
/// BEFORE
MessageListView(
onMessageSwiped: (Message message) => // handle swipe,
...
)
/// AFTER
MessageListView(
messageBuilder: (BuildContext context, Message message) =>
Swipeable(
key: ValueKey(message.id),
onSwiped: (_) => // handle swipe,
child: StreamMessageWidget(
message: message,
...
),
),
)