bavard 0.0.8 copy "bavard: ^0.0.8" to clipboard
bavard: ^0.0.8 copied to clipboard

An Laravel Eloquent-inspired ORM for Flutter. Supports SQLite, PostgreSQL and PowerSync with fluent queries, relationships, soft deletes, timestamps, casts and more.

Bavard #

Bavard is an Eloquent-like ORM for Flutter/Dart, designed to work with SQLite, PostgreSQL, PowerSync or any driver you want.

Caution

This project is under active development. APIs and documentation may change.


Why Bavard?

  • Fluent syntax: Write readable queries such as User().query().where("age", ">", 18).get().
  • Offline-first ready: Native support for client-side UUIDs and driver-agnostic architecture.
  • Advanced features: Already includes Soft Deletes, automatic Timestamps, Global Scopes, and Polymorphic Relationships.

Installation #

Add Bavard to your pubspec.yaml:

dependencies:
  bavard: ^0.0.1

Quick Start #

1. Define a Model #

Extend the Model class and define your table name and hydration logic.

import 'package:bavard/bavard.dart';

class User extends Model {
  @override
  String get table => 'users';

  User([super.attributes]);

  @override
  User fromMap(Map<String, dynamic> map) => User(map);
}

2. Querying #

Use the fluent query builder to retrieve data.

// Get all users over 18
final users = await User().query()
    .where('age', 18, operator: '>')
    .orderBy('name')
    .get();

// Find a specific user
final user = await User().query()
    .where('email', 'mario@example.com')
    .first();

3. CRUD Operations #

Easily create, update, and delete records.

// Create
final newUser = User();
newUser['name'] = 'Luigi';
newUser['email'] = 'luigi@example.com';
await newUser.save();

// Update
final user = await User().query().first();
if (user != null) {
  user['active'] = true;
  await user.save();
}

// Delete
await user?.delete();

Documentation #

See Official Documentation

3
likes
0
points
207
downloads

Publisher

unverified uploader

Weekly Downloads

An Laravel Eloquent-inspired ORM for Flutter. Supports SQLite, PostgreSQL and PowerSync with fluent queries, relationships, soft deletes, timestamps, casts and more.

Repository (GitHub)
View/report issues

Topics

#orm #flutter #dart #powersync #sqlite

License

unknown (license)

Dependencies

analyzer, build, build_runner, source_gen, uuid

More

Packages that depend on bavard