Skip to content

Commit

Permalink
Create flutter_parse_example.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
alann-maulana committed Jul 29, 2021
1 parent c52c372 commit 3fbbee1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions example/flutter_parse_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:flutter_parse/flutter_parse.dart';

main() async {
// create configuration
ParseConfiguration config = ParseConfiguration(
server: 'YOUR_PARSE_SERVER_URL',
applicationId: 'YOUR_PARSE_APPLICATION_ID',
clientKey: 'YOUR_PARSE_CLIENT_KEY',
masterKey: 'YOUR_PARSE_MASTER_KEY',
localStorage: Storage(''),
);
// initialize parse using configuration
Parse.initialize(config);

// create and save object
final object = ParseObject(className: 'Beacon')
..set('proximityUUID', 'CB10023F-A318-3394-4199-A8730C7C1AEC')
..set('major', 1)
..set('enabled', true)
..set('timestamp', DateTime.now());
await object.save();

// query for objects
final query = ParseQuery(className: 'Beacon')
..whereEqualTo('proximityUUID', 'CB10023F-A318-3394-4199-A8730C7C1AEC')
..whereLessThanOrEqualTo('major', 10);
final beacons = await query.findAsync();
print(beacons.length);
}

0 comments on commit 3fbbee1

Please sign in to comment.