From 052bde5f684bc5bba8f56428c830b61e8856825f Mon Sep 17 00:00:00 2001 From: rodrigosmarques Date: Fri, 8 Mar 2019 22:12:40 -0300 Subject: [PATCH] Update parse_object.dart --- lib/src/objects/parse_object.dart | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/src/objects/parse_object.dart b/lib/src/objects/parse_object.dart index d39757582..0695417c9 100644 --- a/lib/src/objects/parse_object.dart +++ b/lib/src/objects/parse_object.dart @@ -164,12 +164,16 @@ class ParseObject extends ParseBase implements ParseCloneable { /// Can be used to add arrays to a given type Future _increment( - ParseApiRQ apiRQType, String arrayAction, String key, num amount) async { + ParseApiRQ apiRQType, String countAction, String key, num amount) async { try { - var uri = "${ParseCoreData().serverUrl}$_path"; - var body = "{\"$key\":{\"__op\": \"$arrayAction\", \"amount\": $amount}"; + if (objectId != null) { + var uri = "${ParseCoreData().serverUrl}$_path/$objectId"; + var body = "{\"$key\":{\"__op\":\"$countAction\",\"amount\":$amount}}"; var result = await _client.put(uri, body: body); return handleResponse(this, result, apiRQType, _debug, className); + } else { + return null; + } } on Exception catch (e) { return handleException(e, apiRQType, _debug, className); }