cloudbase_database 0.0.7

  • Readme
  • Changelog
  • Installing
  • 49

Cloudbase Database for Flutter #


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

安装 #

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

  cloudbase_core: ^0.0.4
  cloudbase_database: ^0.0.7

简单示例 #

import 'package:cloudbase_core/cloudbase_core.dart';
import 'package:cloudbase_auth/cloudbase_auth.dart';
import 'package:cloudbase_database/cloudbase_database.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();

  // 数据库查询
  CloudBaseDatabase database = CloudBaseDatabase(core);
  String myOpenID = 'xxx';
    '_openid': myOpenID

详细文档 #


[0.0.1] - 2020.03.05 #

  • 支持文档型数据库的基本操作

[0.0.2] - 2020.03.12 #

  • 对cloudbase_core核心库的依赖升级到0.0.3

[0.0.3] - 2020.03.13 #

  • 修复请求回包的解析错误

[0.0.4] - 2020.03.13 #

  • 修复解包bug

[0.0.5] - 2020.03.13 #

  • 反序列化有问题,先暂时放开,直接返回系统数据

[0.0.6] - 2020.03.13 #

  • 解决反序列化的bug,并支持ServerDate的数据类型

[0.0.7] - 2020.04.07 #

  • 优化 readme

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  cloudbase_database: ^0.0.7

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:cloudbase_database/cloudbase_database.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Document public APIs. (-1 points)

13 out of 13 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/validater.dart. (-1.99 points)

Analysis of lib/src/validater.dart reported 4 hints:

line 5 col 15: This function has a return type of 'bool', but doesn't end with a return statement.

line 13 col 15: This function has a return type of 'bool', but doesn't end with a return statement.

line 17 col 15: This function has a return type of 'bool', but doesn't end with a return statement.

line 31 col 15: This function has a return type of 'bool', but doesn't end with a return statement.

Fix lib/src/response.dart. (-0.50 points)

Analysis of lib/src/response.dart reported 1 hint:

line 1 col 8: Unused import: 'package:cloudbase_core/cloudbase_core.dart'.

Fix lib/src/serializer.dart. (-0.50 points)

Analysis of lib/src/serializer.dart reported 1 hint:

line 133 col 17: This function has a return type of 'String', but doesn't end with a return statement.

Fix additional 18 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/cloudbase_database.dart (Run flutter format to format lib/cloudbase_database.dart.)
  • lib/src/collection.dart (Run flutter format to format lib/src/collection.dart.)
  • lib/src/command.dart (Run flutter format to format lib/src/command.dart.)
  • lib/src/command/logic.dart (Run flutter format to format lib/src/command/logic.dart.)
  • lib/src/command/query.dart (Run flutter format to format lib/src/command/query.dart.)
  • lib/src/command/update.dart (Run flutter format to format lib/src/command/update.dart.)
  • lib/src/database.dart (Run flutter format to format lib/src/database.dart.)
  • lib/src/document.dart (Run flutter format to format lib/src/document.dart.)
  • lib/src/geo.dart (Run flutter format to format lib/src/geo.dart.)
  • lib/src/geo/lineString.dart (Run flutter format to format lib/src/geo/lineString.dart.)
  • lib/src/geo/multiLineString.dart (Run flutter format to format lib/src/geo/multiLineString.dart.)
  • lib/src/geo/multiPoint.dart (Run flutter format to format lib/src/geo/multiPoint.dart.)
  • lib/src/geo/multiPolygon.dart (Run flutter format to format lib/src/geo/multiPolygon.dart.)
  • lib/src/geo/point.dart (Run flutter format to format lib/src/geo/point.dart.)
  • lib/src/geo/polygon.dart (Run flutter format to format lib/src/geo/polygon.dart.)
  • lib/src/query.dart (Run flutter format to format lib/src/query.dart.)
  • lib/src/regexp.dart (Run flutter format to format lib/src/regexp.dart.)
  • lib/src/serverdate.dart (Run flutter format to format lib/src/serverdate.dart.)

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and cloudbase_database.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
cloudbase_core ^0.0.3 0.0.4
flutter 0.0.0
Transitive dependencies
charcode 1.1.3
collection 1.14.11 1.14.12
dio 3.0.9
flutter_web_plugins 0.0.0
http_parser 3.1.4
meta 1.1.8
path 1.6.4
shared_preferences 0.5.6+3
shared_preferences_macos 0.0.1+6
shared_preferences_platform_interface 1.0.3
shared_preferences_web 0.1.2+4
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies