rethinkdb_dart 2.3.2+5

  • Readme
  • Changelog
  • Example
  • Installing
  • 33

Build Status

Dart 2 and Flutter RethinkDB Driver #

A Dart 2 and Flutter driver for RethinkDB v2.3.

This is a fork of RethinkDB Driver, that was created to update the driver to Dart 2 and Flutter.

Getting Started: #

The driver api tries to align with the javascript and python RethinkDB drivers. You can read their documentation here.

To include this driver in your own project add the package to your pubspec.yaml file:

  rethinkdb_dart: '^2.3.2+5'

Or to use bleeding edge:

    git: git://

Or if you are a developer:

      path: /path/to/your/cloned/rethinkdb_dart

Then import the package into your project:

import 'package:rethinkdb_dart/rethinkdb_dart.dart';

Connect to the database:

var connection = await r.connect(db: "test", host: "localhost", port: 28015);

Create a table:

await r.db('test').tableCreate('tv_shows').run(connection);

Insert some data:

await r.table('tv_shows').insert([
      {'name': 'Star Trek TNG', 'episodes': 178},
      {'name': 'Battlestar Galactica', 'episodes': 75}

And work with the data:

var count = await r.table('tv_shows').count();
print("count: $count");

To run tests execute the following command from the project root:

warning: tests are run against a live database, but they do attempt to clean up after themselves

pub run test  

2.3.2+5 #

  • Made 'SocketException: OS Error: Connection refused' handleable by user code

2.3.2+4 #

  • Fixed connection close listener
  • Fixed connection test according to JavaScript driver

2.3.2+3 #

  • Initial release (driver updated to Dart 2 and Flutter)


import 'package:rethinkdb_dart/rethinkdb_dart.dart';

Rethinkdb r = new Rethinkdb();

void main(List<String> arguments) async {
  var connection;
  try {
    // Create the database connection.
    connection = await r.connect(db: "test", host: "localhost", port: 28015);

    // Drop the table if it exists.
    await r
        .rqlDo((databaseExists) {
      return r.branch(
          databaseExists, r.tableList(), r.db('test').tableDrop('tv_shows'));

    // Create the table if it doesn't exist.
    await r.db('test').tableList().contains('tv_shows').rqlDo((databaseExists) {
      return r.branch(
          databaseExists, r.tableList(), r.db('test').tableCreate('tv_shows'));

    // Insert some data.
    await r.table('tv_shows').insert([
      {'name': 'Star Trek TNG', 'episodes': 178},
      {'name': 'Battlestar Galactica', 'episodes': 75}

    // Display the data count.
    var count = await r.table('tv_shows').count().run(connection);
    print("count: $count");
  } catch (e) {
    print("Error: $e");
  } finally {
    if (connection != null) {

Use this package as a library

1. Depend on it

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

  rethinkdb_dart: ^2.3.2+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:rethinkdb_dart/rethinkdb_dart.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 Dec 10, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.1+4

Health suggestions

Fix lib/src/generated/ql2.pbjson.dart. (-78.54 points)

Analysis of lib/src/generated/ql2.pbjson.dart reported 307 hints, including:

line 7 col 27: Avoid const keyword.

line 9 col 8: Avoid const keyword.

line 12 col 35: Avoid const keyword.

line 14 col 8: Avoid const keyword.

line 15 col 5: Avoid const keyword.

Fix lib/src/generated/ql2.pbenum.dart. (-69.52 points)

Analysis of lib/src/generated/ql2.pbenum.dart reported 237 hints, including:

line 12 col 44: Avoid const keyword.

line 13 col 44: Avoid const keyword.

line 14 col 44: Avoid const keyword.

line 15 col 44: Avoid const keyword.

line 16 col 44: Avoid const keyword.

Fix lib/src/ast.dart. (-51.66 points)

Analysis of lib/src/ast.dart reported 145 hints, including:

line 181 col 14: Unnecessary new keyword.

line 183 col 12: Unnecessary new keyword.

line 188 col 28: Unnecessary new keyword.

line 192 col 12: Unnecessary new keyword.

line 226 col 13: Unnecessary new keyword.

Fix additional 5 files with analysis or formatting issues. (-109.95 points)

Additional issues in the following files:

  • lib/rethinkdb_dart.dart (143 hints)
  • lib/src/net.dart (81 hints)
  • lib/src/generated/ql2.pb.dart (40 hints)
  • lib/src/cursor.dart (15 hints)
  • lib/src/generated/ql2.pbserver.dart (Run dartfmt to format lib/src/generated/ql2.pbserver.dart.)

Maintenance issues and suggestions

Prefer published dependencies. (-100 points)

The source code in a git repository is mutable and could disappear.

Use constrained dependencies. (-20 points)

The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: pbkdf2.

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (protobuf).

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.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.0 <3.0.0
convert ^2.0.2 2.1.1
crypto ^2.0.6 2.1.4
pbkdf2 2.1.0
protobuf ^0.10.2 0.10.8 1.0.1
Transitive dependencies
charcode 1.1.2
collection 1.14.12
fixnum 0.10.11
typed_data 1.1.6
Dev dependencies
test ^1.3.0