ArangoDB driver for Dart with null safety

See EXAMPLE tab for example of code and see tests in repository for much more examples.

Getting Started

First, you need to create a client that represents connections to

  var client = ArangoDBClient(
    scheme: 'http',
    host: '',
    port: 8529, // <- use your real ArangoDB port
    db: 'blog', // <- the name of database for connect
    // User below must have access for you database:
    user: 'user1', // <- use real username for this database
    pass: 'user1password', // <- use real password for this user

Data manipulation and query operations assume the database and the collection already exist. Both can be created from this API. Here's an example of how to create a collection in case it doesn't exist:

  if (!(await cli.allCollections()).result.any((e) => == 'posts')) {
    await cli.createCollection(name: 'posts');

Then, documents to be inserted can be represented as Map<String, dynamic>:

  var createResult = await client.createDocument('posts', // the collection
   // the content of the new document
    'title': 'My new post',
    'public': false, // do not publish it, we want to edit it later
    'content': [
      // let 'content' field is array with a different keys
        // let one of key is 'markdown' with text as it's value:
        'mardown': '__My markdown text__',

Querying is also easy:

  // Let collection 'posts' exists in database 'blog'.
  // Read all titles for public posts.
  var titles = await client
      // this part of query will be added anyway:
      .addLine('FOR post IN posts')
      // part of query will be added only if readOnlyPublic is true:
      .addLineIfThen(readOnlyPublic, 'FILTER post.public')
      // this line will be added if postKey!=null:
      // Look to @key in this line: this is placeholder for binded value
      // (it will appear later):
      .addLineIfThen(true, 'FILTER post._key=@key')
      .addLine('RETURN post.title')
      // binded variable named as 'key' (accessed in query as '@key')
      // will be inserted to query only if postKey!=null:
      .addBindVarIfThen(true, 'key', postKey)
      // Run query now.
      // Remember that we used 'await' keyword in above of this chain.
      .runAndReturnFutureList(); // <-- result type is Future<List>
  // See also .runAndReturnStream() method.


Provides a driver to connect to ArangoDb and perform data manipulation and queries.