This is a simple library that gives you CRUD operations for FAUNA.


A example that shows how to save a Pilot to fauna:

Define an entity class

import 'package:faunadb_data/src/fauna/entity.dart';

class Pilot extends Entity<Pilot> {
  final String id;
  final String name;


  Pilot fromJson(Map<String, dynamic> model) {
    return Pilot(model['id'], model['name']);

  String getId() {

  Map<String, dynamic> model() {
    Map<String,dynamic> model =  {
      "id" :,
    return model;

  static String collection() => "Pilots";

  static String allPilotsIndex() => "all_pilots";

Pilot getPilotFromJson(Map<String, dynamic> json) {
  return Pilot(json['id'] as String, json['name'] as String);

Add Repository

import 'package:faunadb_data/src/fauna/fauna_repository.dart';

import '../model/pilot.dart';

class PilotRepository extends FaunaRepository<Pilot> {
  PilotRepository() : super("Pilots", "all_pilots");
  //all_pilots is an index you need to create on Fauna

import 'package:faunadb_data/faunadb_data.dart';
//Saving an object
main() async {
  PilotRepository pilotRepository = new PilotRepository();
  Optional<String> optionalId = await pilotRepository.nextId();
  String id = optionalId.value;
  Pilot pilot = new Pilot(id, "Test Pilot");

  Pilot result = await, getPilotFromJson);
  //See the test folder on github for more examples

Features and bugs

Please file feature requests and bugs at the issue tracker.


Support for doing something awesome.