Skip to content
pubscout

fluent_query_builder

5.5.0, released 4 years ago by galileodart.com

A fluent SQL query builder library for PostgreSQL and MySQL databases in Dart.

$ flutter pub add fluent_query_builder
Source repository

What it does

Allows developers to construct and execute SQL queries (inserts, updates, deletes, selects) in a fluent, method-chaining manner for PostgreSQL and MySQL. It also implements connection pooling and a basic pre-ORM model mapping feature without code generation.

AI-written summary of version 5.5.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to execute raw or structured SQL queries against PostgreSQL or MySQL databases from Dart.
  • You want a fluent query-building API without dealing with heavy ORM code generation.

Skip it when

  • You are using a non-SQL database like Firebase or Hive.
  • You require a full-featured, complex ORM with advanced relationships and lazy loading.

Strengths

  • Supports both PostgreSQL and MySQL drivers.
  • Fluent API style for common SQL clauses, transactions, and relation mapping.
  • Built-in connection pooling and reconnection resiliency.

Weaknesses

  • Requires manual handling of field and table name escaping in certain contexts.
  • Pre-ORM features are relatively basic compared to full ORM solutions.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
5

Requires database connection parameters (host, port, username, password) configured via DBConnectionInfo.

import 'package:fluent_query_builder/fluent_query_builder.dart';

void main() {
  final pgsqlCom = DBConnectionInfo(
    host: 'localhost',
    database: 'banco_teste',
    driver: ConnectionDriver.pgsql,
    port: 5432,
    username: 'user',
    password: 'pass',
  );

  DbLayer().connect(pgsqlCom).then((db) async {
    final result = await db.select().from('usuarios').getAsMap();
    print(result);
  });
}

Alternatives

Packages that do the same job and could replace fluent_query_builder.

  • dart_odbc

    Dart library for connecting to ODBC data sources and executing SQL queries.

  • sqflite_common_ffi_web

    Sqflite web implementation using sqlite3 ffi and sqlite3 wasm.

  • sqlite3

    Lightweight and convenient SQLite bindings for Dart using dart:ffi

  • cbl

    An offline-first NoSQL document database with SQL++ queries, full-text search, and bi-directional sync.

Works with

Packages commonly used together with fluent_query_builder: ones it builds on, ones built on it, and its own family.