getAllContactsFromServer method
从服务器获取所有的好友
如果获取成功,请调用onSuccess
,如果出现错误,请调用onError
。
Implementation
void getAllContactsFromServer({
onSuccess(List<String> contacts),
onError(int code, String desc)}){
Future<Map<String, dynamic>> result = _emContactManagerChannel
.invokeMethod(EMSDKMethod.getAllContactsFromServer);
result.then((response){
if (response['success']) {
if(onSuccess != null) {
var contacts = List<String>();
if (response['value'] != null) {
for (var contact in response['value']) {
contacts.add(contact);
}
}
onSuccess(contacts);
}
} else {
if (onError != null) onError(response['code'], response['desc']);
}
});
}