cloudbase_function 0.0.2 copy "cloudbase_function: ^0.0.2" to clipboard
cloudbase_function: ^0.0.2 copied to clipboard

Flutter plugin for cloudbase function.

Cloudbase Function for Flutter #

Pub

腾讯云·云开发的 Flutter 插件,更多的云开发 Flutter 插件请见云开发文档

安装 #

在 flutter 项目的 pubspec.yaml 文件的 dependencies 中添加

dependencies:
  cloudbase_core: ^0.0.4
  cloudbase_function: ^0.0.2

简单示例 #

import 'package:cloudbase_core/cloudbase_core.dart';
import 'package:cloudbase_auth/cloudbase_auth.dart';
import 'package:cloudbase_function/cloudbase_function.dart';

void main() async {
  CloudBaseCore core = CloudBaseCore.init({'env': 'your-env-id'});

  // 匿名登录
  CloudBaseAuth auth = CloudBaseAuth(core);
  CloudBaseAuthState authState = await auth.getAuthState();

  if (authState == null) {
      await auth.signInAnonymously();
  }

  // 云函数调用
  CloudBaseFunction function = CloudBaseFunction(core);
  Map<String, dynamic> data = {'a': 1, 'b': 2};
  CloudBaseResponse res = await function.callFunction('sum', data);
  print(res.data) // { sum: 3 }
}

详细文档 #

云开发·云函数

2
likes
10
points
19
downloads

Publisher

verified publishercloudbase.net

Weekly Downloads

Flutter plugin for cloudbase function.

Homepage

License

unknown (license)

Dependencies

cloudbase_core, flutter

More

Packages that depend on cloudbase_function