1
1
import 'package:flutter/material.dart' ;
2
2
import 'package:flutter_plugin_example/application_constants.dart' ;
3
3
import 'package:flutter_plugin_example/diet_plan.dart' ;
4
- import 'package:flutter_plugin_example/subscription.dart' ;
5
4
import 'package:parse_server_sdk/parse.dart' ;
6
5
7
6
void main () => runApp (new MyApp ());
@@ -59,7 +58,6 @@ class _MyAppState extends State<MyApp> {
59
58
initUser ();
60
59
function ();
61
60
functionWithParameters ();
62
- test ();
63
61
}
64
62
65
63
void createItem () async {
@@ -139,13 +137,20 @@ class _MyAppState extends State<MyApp> {
139
137
140
138
initUser () async {
141
139
// All return type ParseUser except all
142
- var user
= ParseUser (
"TestFlutter" ,
"TestPassword123" ,
"[email protected] " );
140
+ var user =
141
+ ParseUser (
"TestFlutter" ,
"TestPassword123" ,
"[email protected] " );
143
142
var response = await user.signUp ();
144
143
if (response.success) user = response.result;
145
144
146
145
response = await user.login ();
147
146
if (response.success) user = response.result;
148
147
148
+ response = await user.requestPasswordReset ();
149
+ if (response.success) user = response.result;
150
+
151
+ response = await user.verificationEmailRequest ();
152
+ if (response.success) user = response.result;
153
+
149
154
user = null ;
150
155
// Best practice for starting the app. This will check for a valid user
151
156
user = await ParseUser .currentUser ();
@@ -155,12 +160,6 @@ class _MyAppState extends State<MyApp> {
155
160
response = await ParseUser .getCurrentUserFromServer ();
156
161
if (response.success) user = response.result;
157
162
158
- response = await user.requestPasswordReset ();
159
- if (response.success) user = response.result;
160
-
161
- response = await user.verificationEmailRequest ();
162
- if (response.success) user = response.result;
163
-
164
163
response = await user.save ();
165
164
if (response.success) user = response.result;
166
165
@@ -179,14 +178,16 @@ class _MyAppState extends State<MyApp> {
179
178
}
180
179
181
180
function () async {
182
-
183
- var user = ParseUser (
"TestFlutter" ,
"TestPassword123" ,
"[email protected] " );
181
+ var user =
182
+ ParseUser (
"TestFlutter" ,
"TestPassword123" ,
"[email protected] " );
184
183
await user.signUp ();
185
184
var loginResponse = await user.login ();
186
185
if (loginResponse.success) user = loginResponse.result;
187
186
188
187
var customClient = ParseHTTPClient ();
189
- customClient.additionalHeaders = { keyHeaderSessionToken: ParseCoreData ().sessionId };
188
+ customClient.additionalHeaders = {
189
+ keyHeaderSessionToken: ParseCoreData ().sessionId
190
+ };
190
191
var function = ParseCloudFunction ('hello' , client: customClient);
191
192
function.execute ();
192
193
@@ -213,15 +214,4 @@ class _MyAppState extends State<MyApp> {
213
214
print ("We have our configs." );
214
215
}
215
216
}
216
-
217
- Future test () async {
218
- var operator = ParseObject ('operator' );
219
- operator .set <String >('objectId' , "npTxjstsAe" );
220
-
221
- var query = QueryBuilder <SubscriptionParse >(SubscriptionParse ())
222
- ..whereEqualTo ('operator' , operator );
223
-
224
- var result = await query.query ();
225
- var response = result;
226
- }
227
217
}
0 commit comments