getConversations method
Get the multiple conversations by the list of UUIDs. Maximum 30 conversations.
It's possible if:
- the user that calls the method is/was a participant of these conversations
- the conversations are the available public conversations (see VIMessenger.getPublicConversations)
uuids
- List of conversation UUIDs. Maximum 30 conversations.
Throws VIException, if operation failed, otherwise returns List of VIConversationEvent instances. For all possible errors see VIMessagingError
Implementation
Future<List<VIConversationEvent>> getConversations(List<String> uuids) async {
try {
List<dynamic>? data = await _methodChannel
.invokeListMethod('Messaging.getConversations', {'uuids': uuids});
if (data == null) {
_VILog._e('VIMessenger: getConversations: data was null, skipping');
throw VIException(
VIMessagingError.ERROR_INTERNAL,
'VIMessenger:getConversations: data was null',
);
}
return data.map((e) => VIConversationEvent._fromMap(e)).toList();
} on PlatformException catch (e) {
throw VIException(e.code, e.message);
}
}