Skip to content

Commit 73e2937

Browse files
RodrigoSMarquesphillwiggins
authored andcommitted
fix some issues / Update README.md (#239)
* fix some issues * Update README.md
1 parent 026efe9 commit 73e2937

File tree

3 files changed

+50
-5
lines changed

3 files changed

+50
-5
lines changed

README.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ It's possible to add other parameters to work with your instance of Parse Server
4444
clientKey: keyParseClientKey, // Required for some setups
4545
debug: true, // When enabled, prints logs to console
4646
liveQueryUrl: keyLiveQueryUrl, // Required if using LiveQuery
47-
autoSendSessionId: true, // Some confurations require this to be true
47+
autoSendSessionId: true, // Required for authentication and ACL
4848
securityContext: securityContext, // Again, required for some setups
49-
coreStore: await CoreStoreSharedPrefsImp.getInstance()); // Will use SharedPreferences instead of Sembast as an internal DB
49+
coreStore: await CoreStoreSharedPrefsImp.getInstance()); // Local data storage method. Will use SharedPreferences instead of Sembast as an internal DB
5050
```
5151

5252
## Objects
@@ -133,6 +133,17 @@ and to retrieve it
133133
var dietPlan = DietPlan().fromPin('OBJECT ID OF OBJECT');
134134
```
135135

136+
## Storage
137+
We now have 2 types of storage, secure and unsecure. We currently rely on 2 third party options:
138+
139+
- SharedPreferences
140+
- Sembast
141+
Sembast offers secured storage, whilst SharePreferences wraps NSUserDefaults (on iOS) and SharedPreferences (on Android).
142+
143+
The storage method is defined in the parameter __coreStore__ in Parse().initialize
144+
145+
Check sample code for options
146+
136147
## Increment Counter values in objects
137148
Retrieve it, call
138149

@@ -578,6 +589,40 @@ final Map<String, String> params = <String, String>{'plan': 'paid'};
578589
function.execute(parameters: params);
579590
```
580591

592+
## Relation
593+
594+
The SDK supports Relation.
595+
596+
To add relation to object:
597+
598+
```dart
599+
dietPlan.addRelation('fruits', [ParseObject("Fruits")..set("objectId", "XGadzYxnac")]);
600+
```
601+
602+
To remove relation to object:
603+
604+
```dart
605+
dietPlan.removeRelation('fruits', [ParseObject("Fruits")..set("objectId", "XGadzYxnac")]);
606+
```
607+
608+
To Retrive a relation instance for user, call:
609+
```dart
610+
final relation = dietPlan.getRelation('fruits');
611+
```
612+
613+
and then you can add a relation to the passed in object:
614+
```
615+
relation.add(dietPlan);
616+
final result = await user.save();
617+
```
618+
619+
To retrieve objects that are members of Relation field of a parent object:
620+
```dart
621+
QueryBuilder<ParseObject> query =
622+
QueryBuilder<ParseObject>(ParseObject('Fruits'))
623+
..whereRelatedTo('fruits', 'DietPlan', DietPlan.objectId);
624+
```
625+
581626
## Other Features of this library
582627
Main:
583628
* Installation (View the example application)

lib/src/network/parse_live_query.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class LiveQuery {
4949
}
5050

5151
final String _className = query.object.parseClassName;
52-
final keysToReturn = query.limiters['keys']?.split(',');
52+
final List<String> keysToReturn = query.limiters['keys']?.split(',');
5353
query.limiters.clear(); //Remove limits in LiveQuery
5454
final String _where = query._buildQuery().replaceAll('where=', '');
5555

@@ -139,7 +139,7 @@ class LiveQuery {
139139
'query': <String, dynamic>{
140140
'className': _className,
141141
'where': _whereMap,
142-
if (keysToReturn != null && keysToReturn.length > 0)
142+
if (keysToReturn != null && keysToReturn.isNotEmpty)
143143
'fields': keysToReturn
144144
}
145145
};

lib/src/network/parse_query.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class QueryBuilder<T extends ParseObject> {
271271
}
272272

273273
Future<ParseResponse> distinct(String className) async {
274-
String queryString = "distinct=$className";
274+
final String queryString = 'distinct=$className';
275275
return object.distinct(queryString);
276276
}
277277

0 commit comments

Comments
 (0)