getMutedConversations static method
Future<List<MutedConversation> >
getMutedConversations({
- dynamic onSuccess(
- List<
MutedConversation> mutedConversations
- List<
- dynamic onError()?,
Retrieves a list of conversations that have been muted by the logged-in user.
This method makes an asynchronous call to the CometChat server to fetch all muted conversations.
Upon successful retrieval, onSuccess
is invoked with a list of MutedConversation objects.
If an error occurs, onError
is called with a CometChatException.
Returns a Future<List<MutedConversation>> which completes with the list of muted conversations, or an empty list if an error occurs.
Implementation
static Future<List<MutedConversation>> getMutedConversations(
{Function(List<MutedConversation> mutedConversations)? onSuccess,
Function(CometChatException e)? onError}) async {
List<MutedConversation> mutedConversations = [];
try {
final result = await channel.invokeMethod('getMutedConversations');
Map<dynamic, dynamic> map = result;
map.forEach((key, value) {
mutedConversations.add(MutedConversation.fromMap(value));
});
if (onSuccess != null) onSuccess(mutedConversations);
return mutedConversations;
} on PlatformException catch (p) {
_errorCallbackHandler(null, p, null, onError);
} catch (e) {
_errorCallbackHandler(null, null, e, onError);
}
return mutedConversations;
}