changeOwner method

void changeOwner ({String groupId, String newOwner, dynamic onSuccess(EMGroup group), dynamic onError(int errorCode, String desc) })

转让群组,群组所有权给他人

Implementation

void changeOwner({
  final String groupId,
  final String newOwner,
  onSuccess(EMGroup group),
  onError(int errorCode, String desc)}) {
  Future<Map<String, dynamic>> result = _emGroupManagerChannel
      .invokeMethod(EMSDKMethod.changeOwner, {"groupId" : groupId, "newOwner" : newOwner});
  result.then((response) {
    if (response['success']) {
      if (onSuccess != null) {
        if(response['value'] != null) {
          onSuccess(EMGroup.from(response['value']));
        }else{
          onSuccess(null);
        }
      }
    } else {
      if (onError != null) onError(response['code'], response['desc']);
    }
  });
}