-
-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ParseUser not supporting custom property ParseGeoPoint #142
Comments
Very strange. for me it's working. dependencies:
flutter:
sdk: flutter
parse_server_sdk: ^1.0.16 My code: var parseObject = ParseObject("TestAPI", debug: true);
parseObject.set<String>("stringName", "Name");
parseObject.set<double>("doubleNumber", 1.5);
parseObject.set<int>("intNumber", 0);
parseObject.set<bool>("boolFound", true);
parseObject.set<List<String>>("listString", ["a", "b", "c", "d"]);
parseObject.set<List<int>>("listNumber", [0, 1]);
parseObject.set<DateTime>("dateTest", DateTime.now());
parseObject.set<Map<String, dynamic>>(
"jsonTest", {"field1": "value1", "field2": "value2"});
parseObject.setIncrement("intNumber2", 2);
parseObject.setDecrement("intNumber3", 2);
//parseObject.set<ParseGeoPoint>(
// "location", ParseGeoPoint(latitude: -20.2523818, longitude: -40.2665611));
final location = ParseGeoPoint(latitude: 48.858372, longitude: 2.294481);
parseObject.set<ParseGeoPoint>("location", location);
parseObject.set<ParseUser>("user", user);
parseObject.set<ParseObject>(
"produto", ParseObject("Produto")..set("objectId", "E7o3gkZD2T"));
parseObject.set<List<ParseUser>>("users", [user, user]);
parseObject.set<ParseFile>("fileImage", parseFile);
parseObject.set<List<ParseFile>>("fileImages", [parseFile, parseFile]);
apiResponse = await parseObject.save(); Response: Payload: {"className":"TestAPI","objectId":"A6SEZ7rVIt","createdAt":"2019-03-29T18:05:02.398Z","stringName":"Name","doubleNumber":1.5,"intNumber":0,"boolFound":true,"listString":["a","b","c","d"],"listNumber":[0,1],"dateTest":{"__type":"Date","iso":"2019-03-29T18:05:01.768Z"},"jsonTest":{"field1":"value1","field2":"value2"},"intNumber2":2,"intNumber3":-2,"location":{"__type":"GeoPoint","latitude":48.858372,"longitude":2.294481},"user":{"__type":"Pointer","className":"_User","objectId":"0C6ptX39c8"},"produto":{"__type":"Pointer","className":"Produto","objectId":"E7o3gkZD2T"},"users":[{"__type":"Pointer","className":"_User","objectId":"0C6ptX39c8"},{"__type":"Pointer","className":"_User","objectId":"0C6ptX39c8"}],"fileImage":{"__type":"File","name":"08dacb56744a958932de46583369b44d_image.png","url":"https://api.feitoemcasaapp.com/1/files/HIn4bvCmAYvwpDmPTmRjfoSwpTPPmGsPUMKYU36Q/08dacb56744a958932de46583369b44d_image.png<…> |
Sure, but you don’t add GeoPoint to a User object in your test case. 😉 Works fine on ParseInstallation class, and on “regular” ParseObject (and subclassed) here too. |
@danibjor I did the test here and also the error occurred for me. |
@danibjor @phillwiggins |
Cheers.
Please use the release/1.0.17 branch.
Thank you!
…On Fri, Mar 29, 2019, 19:54 Rodrigo de Souza Marques < ***@***.***> wrote:
@danibjor <https://github.com/danibjor>
I found the problem, I'm going to do a PR.
@phillwiggins <https://github.com/phillwiggins>
Should I use which branch?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#142 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHgn3pBq-3EltML6e1d50whYrQZm8LNKks5vbm9YgaJpZM4cSrxp>
.
|
@phillwiggins The problem is in the save method on the line containing json.encode. Just remove toEncodable. Parse data types are already being handled in toJson and calling toEncodable causes error. Future<ParseResponse> save() async {
...
final Uri url = getSanitisedUri(_client, '$_path/$objectId');
final String body =
json.encode(toJson(forApiRQ: true), toEncodable: dateTimeEncoder);
... Change to: Future<ParseResponse> save() async {
...
final Uri url = getSanitisedUri(_client, '$_path/$objectId');
final String body =
json.encode(toJson(forApiRQ: true));
.. |
@RodrigoSMarques @danibjor |
@phillwiggins just tested, but my app breaks on ParseInstallation if I'm switching to 1.0.17.
|
@phillwiggins tried changing the sources manually (adding the fix pointed out) and commenting out stuff related to ParseInstallation. Still no go - it saves, but the data is not showing up on the server. Been digging and it seems like the data is not persisted on the GeoPoint object. I make a new GeoPoint, set it on the user and save(). ParseGeoPoint seems to be broken on 1.0.17 Created a pull request that fixes the ParseGeoPoint. Data (location prop of type GeoPoint) on the User object is now persisted on the server. #143 |
Strange that I had already hit Geopoint in branch v1.0.16. I tested the branch 1.0.17 and ParseFile is in error. The strange thing is that the Master code is OK and works correctly in branch v1.0.16 (last). I think it gave some trouble in the merge. [VERBOSE-2: ui_dart_state.cc (148)] Unhandled Exception: Stack Overflow
# 0 ParseFile.toString
../.../Objects/parse_file.dart:44
# 1 ParseFile.toString
../.../Objects/parse_file.dart:45
# 2 ParseFile.toString
../.../Objects/parse_file.dart:45
# 3 ParseFile.toString
../.../Objects/parse_file.dart:45
# 4 ParseFile.toString
../.../Objects/parse_file.dart:45
# 5 Pair <...> |
There's not been much movement on this recently. Are we safe to close? |
Yes, the GeoPoint is working perfectly well, even with the _User class now! |
Sample code:
.save()
throws exception:Edit: as of v1.0.16
The text was updated successfully, but these errors were encountered: