All Projects → LunaGao → Leancloud_flutter_plugin

LunaGao / Leancloud_flutter_plugin

Licence: mit
LeanCloud flutter plugin by Luna Gao

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Leancloud flutter plugin

Flutter Examples
An ultimate cheatbook of curated designs
Stars: ✭ 675 (+1885.29%)
Mutual labels:  flutter-plugin
Fludex
Flutter + Redux = Fludex
Stars: ✭ 17 (-50%)
Mutual labels:  flutter-plugin
Flutter Cinema
Learn to create flutter app with BLoC Architecture
Stars: ✭ 26 (-23.53%)
Mutual labels:  flutter-plugin
Baby
一个私密社交APP,采用Dagger2+Rxjava+LeanCloud+环信+MVP+Tinker进行开发。
Stars: ✭ 687 (+1920.59%)
Mutual labels:  leancloud
Flutter Geolocator
Android and iOS Geolocation plugin for Flutter
Stars: ✭ 759 (+2132.35%)
Mutual labels:  flutter-plugin
Flutter foreground service plugin
Stars: ✭ 19 (-44.12%)
Mutual labels:  flutter-plugin
Flutter candies
custom flutter candies(widgets) for you to build flutter app easily, enjoy it
Stars: ✭ 638 (+1776.47%)
Mutual labels:  flutter-plugin
Flutter Woocommerce Api
WooCommerce API in Flutter, connect and start developing with the available endpoints like get products, create orders and more.
Stars: ✭ 31 (-8.82%)
Mutual labels:  flutter-plugin
Multi image picker
Flutter plugin that allows you to display multi image picker on iOS and Android. 👌🔝🎉
Stars: ✭ 889 (+2514.71%)
Mutual labels:  flutter-plugin
Media picker
A Flutter Plugin for Selecting and Taking New Photos and Videos.
Stars: ✭ 24 (-29.41%)
Mutual labels:  flutter-plugin
Flutterlocation
A Flutter plugin to easily handle realtime location in iOS and Android. Provides settings for optimizing performance or battery.
Stars: ✭ 711 (+1991.18%)
Mutual labels:  flutter-plugin
Flutter image cropper
A Flutter plugin for Android and iOS supports cropping images
Stars: ✭ 723 (+2026.47%)
Mutual labels:  flutter-plugin
Drm wv fp player
Few of the resources from flutter plugin video_player
Stars: ✭ 19 (-44.12%)
Mutual labels:  flutter-plugin
Liquid swipe flutter
A flutter based liquid swipe
Stars: ✭ 680 (+1900%)
Mutual labels:  flutter-plugin
Awesome Flutter
An awesome list that curates the best Flutter libraries, tools, tutorials, articles and more.
Stars: ✭ 38,582 (+113376.47%)
Mutual labels:  flutter-plugin
Bottom navy bar
A beautiful and animated bottom navigation
Stars: ✭ 653 (+1820.59%)
Mutual labels:  flutter-plugin
Table calendar
Highly customizable, feature-packed Flutter Calendar with gestures, animations and multiple formats
Stars: ✭ 897 (+2538.24%)
Mutual labels:  flutter-plugin
Flutter Unity View Widget
Embeddable unity game engine view for Flutter. Advance demo here https://github.com/juicycleff/flutter-unity-arkit-demo
Stars: ✭ 961 (+2726.47%)
Mutual labels:  flutter-plugin
Fluttertoast
Android Toast Plugin for Flutter
Stars: ✭ 957 (+2714.71%)
Mutual labels:  flutter-plugin
Realtime Sdk Flutter
LeanCloud Flutter Plugin SDK
Stars: ✭ 22 (-35.29%)
Mutual labels:  leancloud

LeanCloud flutter plugin

Bless Package version Build Status

Leancloud flutter plugin by Luna Gao

Dark packages

Description

This plugin depends on Leancloud Native(iOS / Android) SDK. It's just convert the code from dart to those native language(Objective-C / Java).

Getting Started

Install

  • Add this to your package's pubspec.yaml file:
dependencies:
  leancloud_flutter_plugin: ^0.0.5
  • Install packages from the command line:
flutter packages get
  • Import it
import 'package:leancloud_flutter_plugin/leancloud_flutter_plugin.dart';

How to use

Before your runApp function, initialize the leancloud. Such as the example app does.

Steps:

  • initialize plugin
  • setup log level (Optional, default value is OFF)
  • setup region (Optional, default value is NorthChina)
  • initialize leancloud
  • save object or you can do whet ever you want :)

Initialize plugin

Plugin is Singleton mode. Please NOT initialize it by yourself.

Import: import 'package:leancloud_flutter_plugin/leancloud_flutter_plugin.dart';

LeancloudFlutterPlugin leancloudFlutterPlugin = LeancloudFlutterPlugin.getInstance();

Log Level (Optional)

Setup log level must be earlier than initialize leancloud function.

leancloudFlutterPlugin.setLogLevel(LeancloudLoggerLevel.DEBUG);

Region (Optional)

Setup region must be earlier than initialize leancloud function.

leancloudFlutterPlugin.setRegion(LeancloudCloudRegion.NorthChina);

Initialize Leancloud

leancloudFlutterPlugin.initialize(appId, appKey);

Create and update an Object

Import: import 'package:leancloud_flutter_plugin/leancloud_object.dart';

// Create
AVObject object = new AVObject("YOUR_OBJECT");
object.put("FIELD_NAME", "VALUE"); // String
object.put("OR_INT", 10); // int
object.put("OR_BOOLEAN", true); // boolean
object.put("OR_FLOAT", 10.01); // float
object.save().then((object) {
  // Saved
  print(object);
  
  // and Update
  object.put("description", "updated!");
  object.save().then((object) {
    // Updated
    print(object);
  });
});

If your update your object, {"code":403,"error":"Forbidden writing by object's ACL."} happened, then please check leancloud data's ACL field.

Delete an Object

// object is an AVObject
object.delete().then((isDeleted) {
  // Deleted
  if (isDeleted) {
    object = null; // you should set ref to null manually if you don't using this object
    print("Deleted!");
  }
});

Query an Object

Import: import 'package:leancloud_flutter_plugin/leancloud_query.dart';

// query by object_id
AVQuery avQuery = new AVQuery("DemoObject");
avQuery.get("OBJECT_ID").then((object) {
  print("Queryed!");
});

// query objects
AVQuery avQuery = new AVQuery("DemoObject");
avQuery.whereEqualTo("KEY", "VALUE"); // string value
avQuery.whereNotEqualTo("KEY", 10); // int value
avQuery.whereGreaterThan("KEY", true); // bool value
avQuery.whereGreaterThanOrEqualTo("KEY", "VALUE");
avQuery.whereLessThan("KEY", "VALUE");
avQuery.whereLessThanOrEqualTo("KEY", "VALUE");
avQuery.find().then((objects) {
  print("All Objects Queryed!");
});

Example App

Example App README.md

Publish Plugin

cd PROJECT_PATH
flutter format .
flutter pub pub publish --dry-run
flutter pub pub publish

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].