Send typing indicators
Send a typing status
tip
- Send a typing indicator to the other party while the user is typing.
- Only supported in direct channels.
Method
Dart
Future<int> sendTypingStatus(String typingMessageType)
Parameters
| Parameter | Type | Description |
|---|---|---|
typingMessageType | String | Current message type identifier (e.g., 'NC:TxtMsg' for text). |
Code example
Dart
final channel = DirectChannel('<target-user-id>');
await channel.sendTypingStatus('NC:TxtMsg');
Listen for typing status changes
Register a ChannelHandler to receive typing status events:
Dart
NCEngine.addChannelHandler('typing-handler', ChannelHandler(
onTypingStatusChanged: (event) {
print(
'Typing status changed in ${event.channelIdentifier.channelId}: ${event.userTypingStatus}',
);
},
));
Remove the handler when it is no longer needed:
Dart
NCEngine.removeChannelHandler('typing-handler');
ChannelUserTypingStatusInfo properties
| Property | Type | Description |
|---|---|---|
userId | String? | User ID of the user currently typing |
typingMessageType | String? | Message type identifier (the typingMessageType value passed by the sender) |
sentTime | int? | Typing timestamp |