Package selection guidance compiled from public package information, community data, and project usage.
The postgres package is a PostgreSQL database driver for Dart and Flutter, enabling efficient database interactions with support for the binary protocol, connection pooling, and statement reuse. It allows developers to build scalable applications that require robust database connectivity across multiple platforms. The driver is designed for performance and reliability, making it suitable for both small projects and large-scale systems. It integrates seamlessly into Flutter apps and supports all major operating systems including Android, iOS, macOS, Windows, and Linux.
Use cases
Connecting Flutter apps to PostgreSQL databases
Building backend services with real-time data
Implementing secure and efficient database queries
Managing high-volume database operations
Supporting cross-platform database access
Key features
Binary protocol support
Connection pooling
Statement reuse
Cross-platform compatibility
Robust error handling
Suitable for
Flutter mobile applications requiring database access
May need additional configuration for production environments
Limited to PostgreSQL database type
Performance depends on network and server configuration
Authentication setup required for secure access
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
PostgreSQL client
A library for connecting to and querying PostgreSQL databases (see Postgres Protocol). This driver uses the more efficient and secure extended query format of the PostgreSQL protocol.
User: username or username:password (can also be set via user/username and password query parameters)
Host: hostname or IP address (defaults to localhost). Supports multiple hosts via comma-separated list (host1:5433,host2:5434) or multiple host query parameters (?host=host1:5433&host=host2:5434)
Port: port number (defaults to 5432, can be overridden via port query parameter)
Database: database name (defaults to postgres, can be overridden via database query parameter)
Parameters: query parameters (see below)
Standard Parameters
These parameters are supported by Connection.openFromUrl():
Parameter
Type
Description
Example Values
application_name
String
Sets the application name
application_name=myapp
client_encoding
String
Character encoding
UTF8, LATIN1
connect_timeout
Integer
Connection timeout in seconds
connect_timeout=30
database
String
Database name (overrides URL path)
database=mydb
host
String
Alternative host specification (supports Unix sockets)