Skip to main content

Typing indicator

Send a typing status

tip
  1. Send a typing indicator to the other party while the user is typing.
  2. Only supported in direct channels.

Method

Dart
Future<int> sendTypingStatus(String currentType)

Parameters

ParameterTypeDescription
currentTypeStringCurrent 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

PropertyTypeDescription
userIdStringUser ID of the user currently typing
contentTypeStringMessage type identifier (the currentType value passed by the sender)
sentTimeintTyping timestamp