createDialog method

Future<QBDialog?> createDialog(
  1. int dialogType, {
  2. List<int>? occupantsIds,
  3. String? dialogName,
  4. String? dialogPhoto,
  5. Map<String, Object>? customData,
})

Implementation

Future<QBDialog?> createDialog(int dialogType,
    {List<int>? occupantsIds, String? dialogName, String? dialogPhoto, Map<String, Object>? customData}) async {
  Map<String, Object> data = Map();

  data["type"] = dialogType;

  if (dialogName != null) {
    data["name"] = dialogName;
  }
  if (occupantsIds != null) {
    data["occupantsIds"] = occupantsIds;
  }
  if (dialogPhoto != null) {
    data["photo"] = dialogPhoto;
  }
  if (customData != null) {
    data["customData"] = customData;
  }

  Map<Object?, Object?> map = await _chatModule.invokeMethod(CREATE_DIALOG_METHOD, data);

  QBDialog? createdDialog = QBDialogMapper.mapToQBDialog(map);

  return createdDialog;
}