mini_bmob 0.1.2 mini_bmob: ^0.1.2 copied to clipboard
Bmob API interface encapsulation supports signature, user, ACL and role, location, data association, object, query, etc
mini_bmob #
Bmob API 接口封装,包含加密传输,包含用户管理、ACL和角色、地理位置、条件查询、数据关联、数组、对象操作。
Bmob API interface encapsulation, including encrypted transmission, including user management, ACL and role, geographic location, conditional query, data association, array and object operation.
安装 #
flutter pub add mini_bmob
引用 #
import 'package:mini_bmob/mini_bmob.dart';
初始化 #
- 非加密形式
可查看测试代码
no_safe_test.dart
BmobConfig.init(
appId,
apiKey,
masterKey: masterKey,
printError: (object, extra) =>L.e(object),
printResponse: (object, extra) =>L.d(object)
);
- 加密形式
可查看测试代码
safe_test.dart
BmobConfig.initSafe(
secretKey,
'JsonYe-',
masterKey: masterKey,
printError: (object, extra) => L.e(object),
printResponse: (object, extra) => L.d(object),
);
登陆 #
BmobUserTable _user = BmobUserTable(username:'JsonYe',password:'123456');
await _user.login(); // 登陆后会自动更新sessionToken
创建表类 #
class BookTable extends BmobTable{}
新增对象 #
BookTable _table = BookTable();
await _table.install();
修改对象 #
await _table.update();
删除对象 #
await _table.delete();
查询列表 #
BmobWhereBuilder _where = BmobWhereBuilder();
_where.whereBasic('name').contain(['Flutter']);
await BmobQueryHelper.list(BookTable(),(json)=>BmobTable().fromJson(json),where:_where);
查询对象详情 #
BookTable _book = BookTable()..objectId='69a8a68a10';
await _book.getInfo();