cloudbase_database 0.0.10

  • Readme
  • Changelog
  • Installing
  • 63

Cloudbase Database for Flutter #

Pub

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

安装 #

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

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';
  database.collection('user').where({
    '_openid': myOpenID
  });
}

详细文档 #

云开发·数据库

[0.0.10] - 2020.06.04 #

  • 修复数据库和移动安全来源的版本协议号冲突的问题

[0.0.9] - 2020.05.14 #

  • 支持实时数据库

[0.0.8] - 2020.04.28 #

  • 修复remove操作的bug

[0.0.7] - 2020.04.07 #

  • 优化 readme

[0.0.6] - 2020.03.13 #

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

[0.0.5] - 2020.03.13 #

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

[0.0.4] - 2020.03.13 #

  • 修复解包bug

[0.0.3] - 2020.03.13 #

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

[0.0.2] - 2020.03.12 #

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

[0.0.1] - 2020.03.05 #

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

Use this package as a library

1. Depend on it

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


dependencies:
  cloudbase_database: ^0.0.10

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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
44
Health:
Code health derived from static analysis. [more]
95
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform Android

Because:

  • package:cloudbase_database/cloudbase_database.dart that imports:
  • package:cloudbase_database/src/realtime/listener.dart that imports:
  • package:cloudbase_database/src/realtime/snapshot.dart that imports:
  • package:cloudbase_database/src/realtime/virtual_websocket_client.dart that imports:
  • package:cloudbase_database/src/realtime/websocket_client.dart that imports:
  • package:cloudbase_database/src/realtime/ws_event.dart that imports:
  • package:cloudbase_core/cloudbase_core.dart that imports:
  • package:cloudbase_core/src/store.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: Linux

Package does not support Flutter platform Linux

Because:

  • package:cloudbase_database/cloudbase_database.dart that imports:
  • package:cloudbase_database/src/realtime/listener.dart that imports:
  • package:cloudbase_database/src/realtime/snapshot.dart that imports:
  • package:cloudbase_database/src/realtime/virtual_websocket_client.dart that imports:
  • package:cloudbase_database/src/realtime/websocket_client.dart that imports:
  • package:cloudbase_database/src/realtime/ws_event.dart that imports:
  • package:cloudbase_core/cloudbase_core.dart that imports:
  • package:cloudbase_core/src/request.dart that imports:
  • package:cloudbase_core/src/sign.dart that imports:
  • package:package_info/package_info.dart that declares support for platforms: Android, iOS, macOS

Package does not support Flutter platform Web

Because:

  • package:cloudbase_database/cloudbase_database.dart that imports:
  • package:cloudbase_database/src/realtime/listener.dart that imports:
  • package:cloudbase_database/src/realtime/snapshot.dart that imports:
  • package:cloudbase_database/src/realtime/virtual_websocket_client.dart that imports:
  • package:cloudbase_database/src/realtime/websocket_client.dart that imports:
  • package:cloudbase_database/src/realtime/ws_event.dart that imports:
  • package:cloudbase_core/cloudbase_core.dart that imports:
  • package:cloudbase_core/src/store.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: Linux

Package does not support Flutter platform Windows

Because:

  • package:cloudbase_database/cloudbase_database.dart that imports:
  • package:cloudbase_database/src/realtime/listener.dart that imports:
  • package:cloudbase_database/src/realtime/snapshot.dart that imports:
  • package:cloudbase_database/src/realtime/virtual_websocket_client.dart that imports:
  • package:cloudbase_database/src/realtime/websocket_client.dart that imports:
  • package:cloudbase_database/src/realtime/ws_event.dart that imports:
  • package:cloudbase_core/cloudbase_core.dart that imports:
  • package:cloudbase_core/src/store.dart that imports:
  • package:shared_preferences/shared_preferences.dart that declares support for platforms: Android, iOS, Linux, macOS, Web

Package does not support Flutter platform iOS

Because:

  • package:cloudbase_database/cloudbase_database.dart that imports:
  • package:cloudbase_database/src/realtime/listener.dart that imports:
  • package:cloudbase_database/src/realtime/snapshot.dart that imports:
  • package:cloudbase_database/src/realtime/virtual_websocket_client.dart that imports:
  • package:cloudbase_database/src/realtime/websocket_client.dart that imports:
  • package:cloudbase_database/src/realtime/ws_event.dart that imports:
  • package:cloudbase_core/cloudbase_core.dart that imports:
  • package:cloudbase_core/src/store.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: Linux

Package does not support Flutter platform macOS

Because:

  • package:cloudbase_database/cloudbase_database.dart that imports:
  • package:cloudbase_database/src/realtime/listener.dart that imports:
  • package:cloudbase_database/src/realtime/snapshot.dart that imports:
  • package:cloudbase_database/src/realtime/virtual_websocket_client.dart that imports:
  • package:cloudbase_database/src/realtime/websocket_client.dart that imports:
  • package:cloudbase_database/src/realtime/ws_event.dart that imports:
  • package:cloudbase_core/cloudbase_core.dart that imports:
  • package:cloudbase_core/src/store.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: Linux

Package not compatible with SDK dart

Because:

  • cloudbase_database that is a package requiring null.

Health issues and suggestions

Document public APIs. (-0.50 points)

173 out of 176 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/document.dart. (-0.50 points)

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

line 10 col 8: Unused import: 'package:cloudbase_database/src/database.dart'.

Fix lib/src/realtime/virtual_websocket_client.dart. (-0.50 points)

Analysis of lib/src/realtime/virtual_websocket_client.dart reported 1 hint:

line 144 col 8: The value of the field '_debug' isn't used.

Fix additional 28 files with analysis or formatting issues. (-2 points)

Additional issues in the following files:

  • lib/src/realtime/websocket_client.dart (1 hint)
  • lib/src/realtime/ws_channel.dart (1 hint)
  • lib/src/realtime/ws_event.dart (1 hint)
  • lib/src/serializer.dart (1 hint)
  • 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/config/error_config.dart (Run flutter format to format lib/src/config/error_config.dart.)
  • lib/src/database.dart (Run flutter format to format lib/src/database.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/realtime/error.dart (Run flutter format to format lib/src/realtime/error.dart.)
  • lib/src/realtime/listener.dart (Run flutter format to format lib/src/realtime/listener.dart.)
  • lib/src/realtime/message.dart (Run flutter format to format lib/src/realtime/message.dart.)
  • lib/src/realtime/snapshot.dart (Run flutter format to format lib/src/realtime/snapshot.dart.)
  • lib/src/realtime/utils.dart (Run flutter format to format lib/src/realtime/utils.dart.)
  • lib/src/regexp.dart (Run flutter format to format lib/src/regexp.dart.)
  • lib/src/response.dart (Run flutter format to format lib/src/response.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/README.md.

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
cloudbase_core ^0.0.9 0.0.9
flutter 0.0.0
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
crypto 2.1.5
dio 3.0.9
file 5.2.1
flutter_web_plugins 0.0.0
http_parser 3.1.4
intl 0.16.1
meta 1.1.8 1.2.2
package_info 0.4.1
path 1.7.0
path_provider_linux 0.0.1+2
path_provider_platform_interface 1.0.2
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
shared_preferences 0.5.8
shared_preferences_linux 0.0.2+1
shared_preferences_macos 0.0.1+10
shared_preferences_platform_interface 1.0.4
shared_preferences_web 0.1.2+7
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 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
xdg_directories 0.1.0
Dev dependencies
flutter_test