Typing indicator
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 currentType)
Parameters
| Parameter | Type | Description |
|---|---|---|
currentType | 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: (channel, userTypingStatus) {
print('Typing status changed in ${channel.channelId}: $userTypingStatus');
},
));
Remove the handler when it is no longer needed:
Dart
NCEngine.removeChannelHandler('typing-handler');
TypingStatus properties
| Property | Type | Description |
|---|---|---|
userId | String | User ID of the user currently typing |
contentType | String | Message type identifier (the currentType value passed by the sender) |
sentTime | int | Typing timestamp |