Hi, this is a Flutter plugin that allows communication with a Parse Server, (https://parseplatform.org) either hosted on your own server or another, like (http://Back4App.com).
This is a work in project and we are consistently updating it. Please let us know if you think anything needs changing/adding, and more than ever, please do join in on this project (Even if it is just to improve our documentation.
Want to get involved? Join our Slack channel and help out! (http://flutter-parse-sdk.slack.com)
To install, either add to your pubspec.yaml
dependencies:
parse_server_sdk: ^1.0.12
or clone this repository and add to your project. As this is an early development with multiple contributors, it is probably best to download/clone and keep updating as an when a new feature is added.
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...
Parse().initialize(
ApplicationConstants.keyApplicationId,
ApplicationConstants.keyParseServerUrl);
It's possible to add other params, such as ...
Parse().initialize(
ApplicationConstants.keyApplicationId,
ApplicationConstants.keyParseServerUrl,
masterKey: ApplicationConstants.keyParseMasterKey,
clientKey: ApplicationConstants.keyParseClientKey,
debug: true,
liveQuery: true,
securityContext: securityContext);
Once you have setup the project and initialised the instance, you can then retreive data from your server by calling:
var apiResponse = await ParseObject('ParseTableName').getAll();
if (apiResponse.success){
for (var testObject in apiResponse.result) {
print(ApplicationConstants.APP_NAME + ": " + testObject.toString());
}
}
Or you can get an object by its objectId:
var dietPlan = await DietPlan().getObject('R5EonpUDWy');
if (dietPlan.success) {
print(ApplicationConstants.keyAppName + ": " + (dietPlan.result as DietPlan).toString());
} else {
print(ApplicationConstants.keyAppName + ": " + dietPlan.exception.message);
}
You can create complex queries to really put your database to the test:
var queryBuilder = QueryBuilder<DietPlan>(DietPlan())
..startsWith(DietPlan.keyName, "Keto")
..greaterThan(DietPlan.keyFat, 64)
..lessThan(DietPlan.keyFat, 66)
..equals(DietPlan.keyCarbs, 5);
var response = await queryBuilder.query();
if (response.success) {
print(ApplicationConstants.keyAppName + ": " + ((response.result as List<dynamic>).first as DietPlan).toString());
} else {
print(ApplicationConstants.keyAppName + ": " + response.exception.message);
}
The features available are:-
You can create custom objects by calling:
var dietPlan = ParseObject('DietPlan')
..set('Name', 'Ketogenic')
..set('Fat', 65);
You then have the ability to do the following with that object: The features available are:-
You can create your own ParseObjects or convert your existing objects into Parse Objects by doing the following:
class DietPlan extends ParseObject implements ParseCloneable {
DietPlan() : super(_keyTableName);
DietPlan.clone(): this();
/// Looks strangely hacky but due to Flutter not using reflection, we have to
/// mimic a clone
@override clone(Map map) => DietPlan.clone()..fromJson(map);
static const String _keyTableName = 'Diet_Plans';
static const String keyName = 'Name';
String get name => get<String>(keyName);
set name(String name) => set<String>(keyName, name);
}
To add a variable to an object call and retrieve it, call
dietPlan.set<int>('RandomInt', 8);
var randomInt = dietPlan.get<int>('RandomInt');
You can now save an object by calling .pin() on an instance of an object
dietPlan.pin();
and to retrieve it
var dietPlan = DietPlan().fromPin('OBJECT ID OF OBJECT');
You can create and control users just as normal using this SDK.
To register a user, first create one :
var user = ParseUser().create("TestFlutter", "TestPassword123", "TestFlutterSDK@gmail.com");
Then have the user sign up:
var response = await user.signUp();
if (response.success) user = response.result;
You can also logout and login with the user:
var response = await user.login();
if (response.success) user = response.result;
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.
user = ParseUser.currentUser();
Other user features are:-
The SDK now supports Parse Config. A map of all configs can be grabbed from the server by calling :
var response = await ParseConfig().getConfigs();
and to add a config:
ParseConfig().addConfig('TestConfig', 'testing');
Main:
User:
Objects:
This project was authored by Phill Wiggins. You can contact me at phill.wiggins@gmail.com
Fixed logout
ParseFile fixed Anonymous login SecurityContext CloudFunctions with objects
Add ParseConfig. Fixed whereEqualsTo('', PARSEOBJECT) and other queries
Fixed Health Check issue
Fixed some queries
Some items now return a response rather than a ParseObject
BREAK FIX - Fixed ParseUser return type so now returns ParseResponse BREAK FIX - Changed query names to make more human readable Fixed pinning and unpinning
Corrected save. Now formatted items correctly for saving on server
Bug fix for get all items Can now pin/unpin/fromPin for all ParseObjects Now supports generics Cody tidy around extending
Added persistent storage. When a logged in user closes the app, then reopens, the data will now be persistent. Best practice would be to Parse.init, then Parse.currentUser. This will return the current user session and allow auto login. Can also pin data in storage.
Fixed login
Added documentation and GeoPoints
First full release!
Added description
Added more cloud functions
example/README.md
Demonstrates how to use the flutter_plugin plugin.
For help getting started with Flutter, view our online documentation.
Add this to your package's pubspec.yaml file:
dependencies:
parse_server_sdk: ^1.0.12
You can install packages from the command line:
with Flutter:
$ flutter packages get
Alternatively, your editor might support flutter packages get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:parse_server_sdk/parse_server_sdk.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
1.0.12 | Feb 16, 2019 |
|
|
1.0.11 | Feb 7, 2019 |
|
|
1.0.10 | Jan 24, 2019 |
|
|
1.0.9 | Jan 21, 2019 |
|
|
1.0.8 | Jan 20, 2019 |
|
|
1.0.7 | Jan 19, 2019 |
|
|
1.0.6 | Jan 19, 2019 |
|
|
1.0.5 | Jan 13, 2019 |
|
|
1.0.4 | Jan 10, 2019 |
|
|
1.0.3 | Jan 9, 2019 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
79
|
Health:
Code health derived from static analysis.
[more]
|
100
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
100
|
Overall:
Weighted score of the above.
[more]
|
89
|
We analyzed this package on Feb 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
Format lib/src/network/parse_http_client.dart
.
Run flutter format
to format lib/src/network/parse_http_client.dart
.
Format lib/src/utils/parse_decoder.dart
.
Run flutter format
to format lib/src/utils/parse_decoder.dart
.
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=2.0.0-dev.68.0 <3.0.0 | ||
flutter | 0.0.0 | ||
http | ^0.12.0 | 0.12.0+1 | |
path_provider | ^0.4.1 | 0.4.1 | 0.5.0+1 |
shared_preferences | ^0.4.3 | 0.4.3 | 0.5.1+1 |
uuid | ^1.0.3 | 1.0.3 | 2.0.0 |
web_socket_channel | ^1.0.9 | 1.0.9 | |
Transitive dependencies | |||
async | 2.0.8 | ||
charcode | 1.1.2 | ||
collection | 1.14.11 | ||
convert | 2.1.1 | ||
crypto | 2.0.6 | ||
http_parser | 3.1.3 | ||
meta | 1.1.6 | 1.1.7 | |
path | 1.6.2 | ||
sky_engine | 0.0.99 | ||
source_span | 1.5.4 | ||
stream_channel | 1.6.8 | ||
string_scanner | 1.0.4 | ||
term_glyph | 1.1.0 | ||
typed_data | 1.1.6 | ||
vector_math | 2.0.8 | ||
Dev dependencies | |||
flutter_test | |||
test | ^1.5.1 |