Skip to content

Commit 75c2575

Browse files
authored
Merge pull request #91 from phillwiggins/release/1.0.13
v1.0.13 - Added full bool
2 parents 3740545 + 5dc388e commit 75c2575

File tree

7 files changed

+19
-11
lines changed

7 files changed

+19
-11
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 1.0.13
2+
Added full bool to convert objects to JSON correctly
3+
14
## 1.0.12
25
Fixed logout
36

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Want to get involved? Join our Slack channel and help out! (http://flutter-parse
1313
To install, either add to your pubspec.yaml
1414
```
1515
dependencies:
16-
parse_server_sdk: ^1.0.12
16+
parse_server_sdk: ^1.0.13
1717
```
1818
or clone this repository and add to your project. As this is an early development with multiple contributors, it is probably best to download/clone and keep updating as an when a new feature is added.
1919

lib/src/base/parse_constants.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
part of flutter_parse_sdk;
22

33
// Library
4-
const String keySdkVersion = '1.0.12';
4+
const String keySdkVersion = '1.0.13';
55
const String keyLibraryName = 'Flutter Parse SDK';
66

77
// End Points

lib/src/objects/parse_base.dart

+6-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ abstract class ParseBase {
2424

2525
/// Converts object to [String] in JSON format
2626
@protected
27-
toJson({bool forApiRQ: false}) {
27+
toJson({bool full, bool forApiRQ: false}) {
2828
final map = <String, dynamic>{
2929
keyVarClassName: className,
3030
};
@@ -42,7 +42,7 @@ abstract class ParseBase {
4242
}
4343

4444
getObjectData().forEach((key, value) {
45-
if (!map.containsKey(key)) map[key] = parseEncode(value);
45+
if (!map.containsKey(key)) map[key] = parseEncode(value, full: full);
4646
});
4747

4848
if (forApiRQ) {
@@ -135,9 +135,10 @@ abstract class ParseBase {
135135
Future<bool> pin() async {
136136
if (objectId != null) {
137137
await unpin();
138-
var objectToSave = json.encode(toJson());
139-
await ParseCoreData().getStore()
140-
..setString(objectId, objectToSave);
138+
final Map<String, dynamic> objectMap = parseEncode(this, full: true);
139+
final String json = jsonEncode(objectMap);
140+
var store = await ParseCoreData().getStore();
141+
store.setString(objectId, json);
141142
return true;
142143
} else {
143144
return false;

lib/src/objects/parse_file.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ParseFile extends ParseObject {
1111
bool get saved => url != null;
1212

1313
@override
14-
toJson({bool forApiRQ: false}) =>
14+
toJson({bool full: false, bool forApiRQ: false}) =>
1515
<String, String>{'__type': keyFile, 'name': name, 'url': url};
1616

1717
@override

lib/src/utils/parse_encoder.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dynamic dateTimeEncoder(dynamic item) {
99
}
1010

1111
/// Custom json encoder for types related to parse
12-
dynamic parseEncode(dynamic value) {
12+
dynamic parseEncode(dynamic value, {bool full = false}) {
1313
if (value is DateTime) return _encodeDate(value);
1414

1515
if (value is List) {
@@ -19,7 +19,11 @@ dynamic parseEncode(dynamic value) {
1919
}
2020

2121
if (value is ParseObject) {
22-
return _encodeObject(value);
22+
if (full) {
23+
return value.toJson(full: full);
24+
} else {
25+
return _encodeObject(value);
26+
}
2327
}
2428

2529
if (value is ParseUser) {

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: parse_server_sdk
22
description: Flutter plugin for Parse Server, (https://parseplatform.org), (https://back4app.com)
3-
version: 1.0.12
3+
version: 1.0.13
44
homepage: https://github.com/phillwiggins/flutter_parse_sdk
55
author: PhillWiggins <[email protected]>
66

0 commit comments

Comments
 (0)