drift_postgres
1.3.1, released a year ago by simonbinder.eu
Postgres implementation and APIs for the drift database package.
What it does
Extends the drift database package to support talking to PostgreSQL databases using the postgres package. It provides a PgDatabase connection class and postgres-specific database APIs.
AI-written summary of version 1.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are using drift and need to connect to a PostgreSQL database instead of SQLite
- You want to use drift's query builder and code generation with Postgres
Skip it when
- You are using local-only storage like SQLite or Hive
- You do not use the drift package
Strengths
- Enables drift ORM features for PostgreSQL
- Supports Postgres-specific types, arrays, and functions like now()
Weaknesses
- Requires a running PostgreSQL instance for backend connectivity and testing
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
Add dependencies to pubspec.yaml, configure build.yaml for drift_dev options with postgres dialect, and instantiate PgDatabase.
final database = AppDatabase(PgDatabase(
endpoint: PgEndpoint(
host: 'localhost',
database: 'postgres',
username: 'postgres',
password: 'postgres',
),
));Alternatives
Packages that do the same job and could replace drift_postgres.
- drift_sqlite_async
Use Drift with a sqlite_async database in the same application.
80Compare - sqflite
SQLite plugin for Flutter supporting iOS, Android and MacOS.
96Compare - hive_ce
A lightweight and fast NoSQL key-value database written in pure Dart.
96Compare - sqflite_common
Dart wrapper on SQLite providing the common API for sqflite and desktop FFI implementations.
93Compare
Works with
Packages commonly used together with drift_postgres: ones it builds on, ones built on it, and its own family.
- uuiddrift_postgres depends on itGenerates and parses RFC‑4122/9562 UUIDs (v1‑v8) for Dart.
- driftdrift_postgres depends on itDrift is a reactive library to store relational data in Dart and Flutter applications.
- postgresdrift_postgres depends on itPostgreSQL driver for Dart supporting binary protocol, pooling and statement reuse.
- drift_devSame familyGenerates Dart database code from Drift table definitions as a dev‑dependency.
- drift_flutterSame familyProvides a simple Flutter‑specific helper to open drift databases on all platforms.
- drift_sqfliteSame familyFlutter-only drift implementation using sqflite for SQLite storage.
- drift_hranaSame familyWraps hrana to connect drift to remote libsql/Turso databases