StreamChat(
client: client,
configData: StreamChatConfigurationData(
draftMessagesEnabled: false,
),
child: child,
),Draft Messages
The Flutter SDK provides a way to create and manage draft messages.
Draft messages are enabled by default. To disable this feature, set draftMessagesEnabled to false in StreamChatConfigurationData:
Draft messages are synchronized across devices and work seamlessly offline as well.
Basic Usage
When draft messages are enabled, the logic of saving and deleting drafts will be handled automatically by the SDK. When a user starts typing a message and then navigates away from the conversation, the message content is automatically saved as a draft, for both Channels and Threads.
When the user returns to the conversation, the draft message will be loaded automatically into the composer. If the user clears the composer content or publishes the message, the draft will be deleted.
The draft messages user flow is described in the following diagram:
flowchart LR
A[User Action]
A -->|Leave Channel| F[Update Channel Draft]
A -->|Leave Thread| E[Update Thread Draft]
A -->|Clear Composer Content| D[Delete Draft]
A -->|Publish Message| D[Delete Draft]Customization
By default, the only UI added to the SDK when drafts are enabled is a preview of the draft message in the channel list and thread list. When a draft is saved, the draft message is shown in the channel list and thread list until the message is published or deleted.

Draft Events
By default, the SDK will react whenever a draft is updated or deleted. But, in case your app needs additional logic, these are the available draft events:
DraftUpdatedEvent: Triggered when a draft is updated.DraftDeletedEvent: Triggered when a draft is deleted.