Skip to main content

Draft

Save a draft

Save draft content to a specific channel by calling channel.saveDraft().

  • Saving a draft updates the channel's operationTime, moving it toward the top of the list.

Method

Dart
Future<int> saveDraft(String draft, ErrorHandler handler)

Code example

Dart
final channel = DirectChannel('<target-user-id>');
await channel.saveDraft(
'Draft text content',
(error) {
if (error == null) {
print('Draft saved');
}
},
);

Get a draft

Use channel.reload() to refresh channel data, then read channel.draft.

Clear a draft

Dart
await channel.clearDraft((error) {
if (error == null) {
print('Draft cleared');
}
});