/
parse_facade_example.dart
33 lines (27 loc) · 1.1 KB
/
parse_facade_example.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) 2016, kulshekhar. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
import 'package:parse_facade/parse_facade.dart';
main() async {
// Initialize your parse app
Parse.initialize('applicationId', 'javascriptKey');
// set the URL of parse-server
Parse.serverURL = 'http://localhost:1337/parse';
// Object declaration
var p1 = new ParseObject('Person');
p1.set('address', 'some place');
await p1.save();
// you can also save an object with additional attributes
await p1.save(attributes: {'someNum': 100});
// alternative object declaration
var p2 = new ParseObject('Person', {'address': 'some place'});
await p2.save();
// Signing up a user using the static method
await ParseUser.signUpUser('username', 'password');
// Signing up a user with attributes using the static method
await ParseUser.signUpUser('username', 'password', {'address': 'some place'});
// Signup a user from a User instance
var u1 = new ParseUser()
..username = 'user1'
..password = 'password1';
await u1.signUp();
}