Is it possible for a flutter application to use RethinkDB?

1,290

Yes, it is possible to use RethinkDB with a flutter application.

There is a rethinkdb_dart package on pub.dev.

There you can also find a example on how to use the package:

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

dependencies:
rethinkdb_dart: '^2.3.2+6'

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}
]).run(connection);

And work with the data:

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

Be aware that you will have to set up the database by yourself. How to do so is explained in the RethinkDB docs.

Share:
1,290
divine
Author by

divine

Updated on December 18, 2022

Comments

  • divine
    divine over 1 year

    I'm planning to build an app that uses a NoSQL database and RethinkDB sounds good, but there's not enough info about how to connect a flutter app to RethinkDB, since many resources and videos favor firebase.

    So if it's possible to build a database for my flutter app using RethinkDB, how can I go about doing that?

  • Medo Elkamaly
    Medo Elkamaly about 4 years
    what about changesfeed?