@@ -11,7 +11,7 @@ Want to get involved? Join our Slack channel and help out! (http://flutter-parse
11
11
12
12
## Getting Started
13
13
To install, either add to your pubspec.yaml
14
- ```
14
+ ``` yml
15
15
dependencies :
16
16
parse_server_sdk : ^1.0.16
17
17
` ` `
@@ -20,15 +20,15 @@ or clone this repository and add to your project. As this is an early developmen
20
20
21
21
Once you have the library added to your project, upon first call to your app (Similar to what your application class would be) add the following...
22
22
23
- ```
23
+ ` ` ` dart
24
24
Parse().initialize(
25
25
ApplicationConstants.keyApplicationId,
26
26
ApplicationConstants.keyParseServerUrl);
27
27
```
28
28
29
29
It's possible to add other params, such as ...
30
30
31
- ```
31
+ ``` dart
32
32
Parse().initialize(
33
33
ApplicationConstants.keyApplicationId,
34
34
ApplicationConstants.keyParseServerUrl,
@@ -42,7 +42,7 @@ Parse().initialize(
42
42
43
43
## Queries
44
44
Once you have setup the project and initialised the instance, you can then retreive data from your server by calling:
45
- ```
45
+ ``` dart
46
46
var apiResponse = await ParseObject('ParseTableName').getAll();
47
47
48
48
if (apiResponse.success){
@@ -53,7 +53,7 @@ var apiResponse = await ParseObject('ParseTableName').getAll();
53
53
```
54
54
Or you can get an object by its objectId:
55
55
56
- ```
56
+ ``` dart
57
57
var dietPlan = await DietPlan().getObject('R5EonpUDWy');
58
58
59
59
if (dietPlan.success) {
@@ -67,7 +67,7 @@ var dietPlan = await DietPlan().getObject('R5EonpUDWy');
67
67
## Complex queries
68
68
You can create complex queries to really put your database to the test:
69
69
70
- ```
70
+ ``` dart
71
71
var queryBuilder = QueryBuilder<DietPlan>(DietPlan())
72
72
..startsWith(DietPlan.keyName, "Keto")
73
73
..greaterThan(DietPlan.keyFat, 64)
@@ -110,7 +110,7 @@ The features available are:-
110
110
## Objects
111
111
112
112
You can create custom objects by calling:
113
- ```
113
+ ``` dart
114
114
var dietPlan = ParseObject('DietPlan')
115
115
..set('Name', 'Ketogenic')
116
116
..set('Fat', 65);
@@ -132,7 +132,7 @@ The features available are:-
132
132
## Custom Objects
133
133
You can create your own ParseObjects or convert your existing objects into Parse Objects by doing the following:
134
134
135
- ```
135
+ ``` dart
136
136
class DietPlan extends ParseObject implements ParseCloneable {
137
137
138
138
DietPlan() : super(_keyTableName);
@@ -155,7 +155,7 @@ class DietPlan extends ParseObject implements ParseCloneable {
155
155
156
156
To add a variable to an object call and retrieve it, call
157
157
158
- ```
158
+ ``` dart
159
159
dietPlan.set<int>('RandomInt', 8);
160
160
var randomInt = dietPlan.get<int>('RandomInt');
161
161
```
@@ -164,21 +164,21 @@ var randomInt = dietPlan.get<int>('RandomInt');
164
164
165
165
You can now save an object by calling .pin() on an instance of an object
166
166
167
- ```
167
+ ``` dart
168
168
dietPlan.pin();
169
169
```
170
170
171
171
and to retrieve it
172
172
173
- ```
173
+ ``` dart
174
174
var dietPlan = DietPlan().fromPin('OBJECT ID OF OBJECT');
175
175
```
176
176
177
177
## Increment Counter values in objects
178
178
179
179
Retrieve it, call
180
180
181
- ```
181
+ ``` dart
182
182
var response = await dietPlan.increment("count", 1);
183
183
184
184
```
@@ -187,7 +187,7 @@ var response = await dietPlan.increment("count", 1);
187
187
188
188
Retrieve it, call
189
189
190
- ```
190
+ ``` dart
191
191
var response = await dietPlan.add("listKeywords", ["a", "a","d"]);
192
192
193
193
var response = await dietPlan.addUnique("listKeywords", ["a", "a","d"]);
@@ -202,22 +202,22 @@ var response = await dietPlan.remove("listKeywords", ["a"]);
202
202
You can create and control users just as normal using this SDK.
203
203
204
204
To register a user, first create one :
205
- ```
205
+ ``` dart
206
206
var user = ParseUser().create("TestFlutter", "TestPassword123", "TestFlutterSDK@gmail.com");
207
207
```
208
208
Then have the user #:
209
209
210
- ```
210
+ ``` dart
211
211
var response = await user.#();
212
212
if (response.success) user = response.result;
213
213
```
214
214
You can also logout and login with the user:
215
- ```
215
+ ``` dart
216
216
var response = await user.login();
217
217
if (response.success) user = response.result;
218
218
```
219
219
Also, once logged in you can manage sessions tokens. This feature can be called after Parse().init() on startup to check for a logged in user.
220
- ```
220
+ ``` dart
221
221
user = ParseUser.currentUser();
222
222
```
223
223
Other user features are:-
@@ -231,12 +231,12 @@ Other user features are:-
231
231
## Config
232
232
233
233
The SDK now supports Parse Config. A map of all configs can be grabbed from the server by calling :
234
- ```
234
+ ``` dart
235
235
var response = await ParseConfig().getConfigs();
236
236
```
237
237
238
238
and to add a config:
239
- ```
239
+ ``` dart
240
240
ParseConfig().addConfig('TestConfig', 'testing');
241
241
```
242
242
0 commit comments