LeanCloud Storage Flutter SDK
Adding dependency in pubspec.yaml
:
dependencies:
...
leancloud_storage: ^0.7.4
Then run the following command:
$ flutter pub get
import 'package:leancloud_storage/leancloud.dart';
LeanCloud.initialize(
APP_ID, APP_KEY,
server: APP_SERVER, // to use your own custom domain
queryCache: new LCQueryCache() // optinoal, enable cache
);
Enable debug logs:
LCLogger.setLevel(LCLogger.DebugLevel);
LCObject object = new LCObject('Hello');
object['intValue'] = 123;
await object.save();
LCQuery<LCObject> query = new LCQuery<LCObject>('Hello');
query.limit(limit);
List<LCObject> list = await query.find();
LCFile file = await LCFile.fromPath('avatar', './avatar.jpg');
await file.save(onProgress: (int count, int total) {
print('$count/$total');
if (count == total) {
print('done');
}
});
await LCUser.login('hello', 'world');
LCGeoPoint p1 = new LCGeoPoint(20.0059, 110.3665);
Refer to LeanStorage Flutter Guide for more usage information. The guide is also available in Chinese (中文指南).
For LeanMessage, check out LeanCloud Official Plugin.