unmuteConversations static method
- List<
UnmutedConversation> unmutedConversations, - {dynamic onSuccess(
- String response
- dynamic onError( )?}
Unmutes the specified conversations for the logged-in user.
This method asynchronously sends a request to the CometChat server to unmute the provided list of conversations.
Upon a successful unmute operation, onSuccess
is invoked with a success response.
If an error occurs, onError
is called with a CometChatException.
Returns a Future<String?> which completes with a success response if the operation is successful, or null if an error occurs.
Implementation
static Future<String?> unmuteConversations(List<UnmutedConversation> unmutedConversations, {Function(String response)? onSuccess, Function(CometChatException e)? onError}) async {
try {
Map<int, dynamic> map = <int, dynamic> {};
for(int i=0; i<unmutedConversations.length; i++){
map[i] = unmutedConversations[i].toMap();
}
final result = await channel.invokeMethod('unmuteConversations', map);
if(onSuccess != null) onSuccess(result);
return result;
} on PlatformException catch (platformException) {
if(onError != null) onError(CometChatException(platformException.code, platformException.details, platformException.message));
} catch (e) {
if(onError != null) onError(CometChatException(ErrorCode.errorUnhandledException, e.toString() , e.toString()));
}
return null;
}