Skip to content
pubscout

drift_postgres

1.3.1, released a year ago by simonbinder.eu

Postgres implementation and APIs for the drift database package.

Quiet but busy
$ flutter pub add drift_postgres
Source repository

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.

Works with

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