create method

Future<ParseResponse> create({
  1. bool allowCustomObjectId = false,
})

Creates a new object and saves it online

Prefer using save over create

Implementation

Future<ParseResponse> create({bool allowCustomObjectId = false}) async {
  try {
    final Uri url = getSanitisedUri(_client, _path);
    final String body = json.encode(toJson(
      forApiRQ: true,
      allowCustomObjectId: allowCustomObjectId,
    ));

    _saveChanges();

    final ParseNetworkResponse result =
        await _client.post(url.toString(), data: body);

    final response = handleResponse<ParseObject>(
        this, result, ParseApiRQ.create, _debug, parseClassName);

    if (!response.success) {
      _notifyChildrenAboutErrorSaving();
    }

    return response;
  } on Exception catch (e) {
    _notifyChildrenAboutErrorSaving();
    return handleException(e, ParseApiRQ.create, _debug, parseClassName);
  }
}