cloudbase_dart 0.0.5

  • Readme
  • Changelog
  • Installing
  • new55

Cloudbase Database for Dart #

Pub

腾讯云·云开发的 Dart 插件。

安装 #

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

dependencies:
  cloudbase_dart: ^0.0.5

简单示例 #

import 'package:cloudbase_dart/cloudbase_dart.dart';

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

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

  // 数据库查询
  CloudBaseDatabase database = CloudBaseDatabase(core);
  String myOpenID = 'xxx';
  DbQueryRes res2 = await database.collection('user').where({
    '_openid': myOpenID
  }).get();
}

secretIdsecretKey 是腾讯云 API 固定密钥对,前往获取

详细文档 #

云开发·数据库

[0.0.5] - 2020.07.02 #

  • 优化 readme

[0.0.4] - 2020.07.01 #

  • 支持在云应用和云函数里,通过内网请求云开发服务。

[0.0.3] - 2020.06.27 #

  • 修改请求api。

[0.0.2] - 2020.06.27 #

  • 修复初始化的bug。

[0.0.1] - 2020.06.27 #

  • 支持在 dart server 里调用云函数和云数据库。

Use this package as a library

1. Depend on it

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


dependencies:
  cloudbase_dart: ^0.0.5

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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_dart/cloudbase_dart.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
36
Health:
Code health derived from static analysis. [more]
85
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
55
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.14

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because:

  • package:cloudbase_dart/cloudbase_dart.dart that imports:
  • package:cloudbase_dart/src/core/request.dart that imports:
  • package:cloudbase_dart/src/core/utils.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:cloudbase_dart/cloudbase_dart.dart that imports:
  • package:cloudbase_dart/src/core/request.dart that imports:
  • package:cloudbase_dart/src/core/utils.dart that imports:
  • dart:io

Health suggestions

Fix lib/src/database/geo.dart. (-2.48 points)

Analysis of lib/src/database/geo.dart reported 5 hints:

line 14 col 12: Unnecessary new keyword.

line 18 col 12: Unnecessary new keyword.

line 22 col 12: Unnecessary new keyword.

line 26 col 12: Unnecessary new keyword.

line 30 col 12: Unnecessary new keyword.

Fix lib/src/database/validater.dart. (-2.48 points)

Analysis of lib/src/database/validater.dart reported 5 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.

line 31 col 36: Avoid types as parameter names.

Fix lib/src/database/query.dart. (-1.99 points)

Analysis of lib/src/database/query.dart reported 4 hints:

line 1 col 8: Unused import: 'dart:convert'.

line 2 col 8: Unused import: 'dart:math'.

line 98 col 9: Use isNotEmpty instead of length

line 201 col 9: Use isNotEmpty instead of length

Fix additional 24 files with analysis or formatting issues. (-9.48 points)

Additional issues in the following files:

  • lib/src/functions/functions.dart (3 hints)
  • lib/src/sign/signer.dart (3 hints)
  • lib/src/core/base.dart (2 hints)
  • lib/src/database/geo/multiLineString.dart (2 hints)
  • lib/src/database/geo/multiPolygon.dart (2 hints)
  • lib/src/database/geo/polygon.dart (2 hints)
  • lib/src/database/command/logic.dart (1 hint)
  • lib/src/database/command/update.dart (1 hint)
  • lib/src/database/document.dart (1 hint)
  • lib/src/database/geo/multiPoint.dart (1 hint)
  • lib/src/database/serializer.dart (1 hint)
  • lib/cloudbase_dart.dart (Run dartfmt to format lib/cloudbase_dart.dart.)
  • lib/src/database/collection.dart (Run dartfmt to format lib/src/database/collection.dart.)
  • lib/src/database/command.dart (Run dartfmt to format lib/src/database/command.dart.)
  • lib/src/database/command/query.dart (Run dartfmt to format lib/src/database/command/query.dart.)
  • lib/src/database/config/error_config.dart (Run dartfmt to format lib/src/database/config/error_config.dart.)
  • lib/src/database/database.dart (Run dartfmt to format lib/src/database/database.dart.)
  • lib/src/database/geo/lineString.dart (Run dartfmt to format lib/src/database/geo/lineString.dart.)
  • lib/src/database/geo/point.dart (Run dartfmt to format lib/src/database/geo/point.dart.)
  • lib/src/database/regexp.dart (Run dartfmt to format lib/src/database/regexp.dart.)
  • lib/src/database/response.dart (Run dartfmt to format lib/src/database/response.dart.)
  • lib/src/database/serverdate.dart (Run dartfmt to format lib/src/database/serverdate.dart.)
  • lib/src/sign/keyvalue.dart (Run dartfmt to format lib/src/sign/keyvalue.dart.)
  • lib/src/sign/utils.dart (Run dartfmt to format lib/src/sign/utils.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_dart.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.6.0 <3.0.0
crypto ^2.1.3 2.1.5
dio ^3.0.7 3.0.9
intl ^0.16.1 0.16.1
Transitive dependencies
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
convert 2.1.1
http_parser 3.1.4
meta 1.2.2 1.3.0-nullsafety
path 1.7.0
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
Dev dependencies
test ^1.14.7