dependencies:
stream_chat_flutter: ^7.0.0 # full UI, core and client packages
stream_chat: ^7.0.0 # client package
v7.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.sort
has 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.sort
has been removed in favor ofStreamChatClient.queryChannels.channelStateSort
.
/// BEFORE
streamChatClient.getChannelStates(
...
sort: [SortOption('last_message_at')],
)
/// AFTER
streamChatClient.getChannelStates(
...
channelStateSort: [SortOption('last_message_at')],
)
MessageWidget.customAttachmentBuilders
has 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.retryTimeout
has been removed in favor ofRetryPolicy.delayFactor
.StreamChatNetworkError.fromDioError
has been removed in favor ofStreamChatNetworkError.fromDioException
.MessageSendingStatus
has been removed in favor ofMessageState
.StreamChannelListController.sort
has been removed in favor ofStreamChannelListController.channelStateSort
.ChannelPreview
has been removed in favor ofStreamChannelListTile
.ChannelPreviewBuilder
has been removed in favor ofStreamChannelListViewIndexedWidgetBuilder
.StreamUserItem
has been removed in favor ofStreamUserListTile
.ReturnActionType
has been removed and no longer used.StreamMessageInput.attachmentThumbnailBuilders
has been removed in favor ofStreamMessageInput.mediaAttachmentBuilder
.MessageWidget.showReactionPickerIndicator
has been removed in favor ofMessageWidget.showReactionPicker
.MessageWidget.bottomRowBuilder
has been removed in favor ofMessageWidget.bottomRowBuilderWithDefaultWidget
.MessageWidget.deletedBottomRowBuilder
has been removed in favor ofMessageWidget.deletedBottomRowBuilderWithDefaultWidget
.MessageWidget.usernameBuilder
has been removed in favor ofMessageWidget.usernameBuilderWithDefaultWidget
.MessageWidget.showReactionPickerTail
has been removed in favor ofMessageWidget.showReactionPicker
.MessageTheme.linkBackgroundColor
has been removed in favor ofMessageTheme.urlAttachmentBackgroundColor
.showConfirmationDialog
has been removed in favor ofshowConfirmationBottomSheet
.showInfoDialog
has been removed in favor ofshowInfoBottomSheet
.wrapAttachmentWidget
has been removed in favor ofWrapAttachmentWidget
.MessageListView.onMessageSwiped
parameter. Try wrapping theMessageWidget
with aSwipeable
,Dismissible
or 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,
...
),
),
)