getContact method
- required String userId,
Gets contact by userId.
Param userId
user id。
Return The contact.
Throws A description of the exception. See ChatError.
Implementation
Future<ChatContact?> getContact({required String userId}) async {
Map req = {'userId': userId};
Map result = await _channel.invokeMethod(ChatMethodKeys.getContact, req);
try {
ChatError.hasErrorFromResult(result);
if (result.containsKey(ChatMethodKeys.getContact)) {
return ChatContact.fromJson(result[ChatMethodKeys.getContact]);
} else {
return null;
}
} on ChatError catch (e) {
throw e;
}
}