postgres 0.9.1

  • Installing
  • Versions
  • 77


Build Status

A library for connecting to and querying PostgreSQL databases.

This driver uses the more efficient and secure extended query format of the PostgreSQL protocol.


Create PostgreSQLConnections and open them:

var connection = new PostgreSQLConnection("localhost", 5432, "dart_test", username: "dart", password: "dart");

Execute queries with query:

var results = await connection.query("SELECT a, b FROM table WHERE a = @aValue", substitutionValues: {
    "aValue" : 3

Execute queries in a transaction:

await connection.transaction((ctx) async {
    var result = await ctx.query("SELECT id FROM table");
    await ctx.query("INSERT INTO table (id) VALUES (@a:int4)", {
        "a" : result.last[0] + 1

See the API documentation:

Features and bugs

Please file feature requests and bugs at the issue tracker.



  • Added transactions: PostgreSQLConnection.transaction and PostgreSQLConnection.cancelTransaction.


  • Initial version

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  postgres: "^0.9.1"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:postgres/postgres.dart';
Version Uploaded Documentation Archive
0.9.9 Apr 6, 2018 Go to the documentation of postgres 0.9.9 Download postgres 0.9.9 archive
0.9.8 Mar 28, 2018 Go to the documentation of postgres 0.9.8 Download postgres 0.9.8 archive
0.9.7 Mar 19, 2018 Go to the documentation of postgres 0.9.7 Download postgres 0.9.7 archive
0.9.6 Oct 5, 2017 Go to the documentation of postgres 0.9.6 Download postgres 0.9.6 archive
0.9.5 Mar 15, 2017 Go to the documentation of postgres 0.9.5 Download postgres 0.9.5 archive
0.9.4+1 Dec 13, 2016 Go to the documentation of postgres 0.9.4+1 Download postgres 0.9.4+1 archive
0.9.4 Dec 6, 2016 Go to the documentation of postgres 0.9.4 Download postgres 0.9.4 archive
0.9.3 Nov 30, 2016 Go to the documentation of postgres 0.9.3 Download postgres 0.9.3 archive
0.9.2 Nov 21, 2016 Go to the documentation of postgres 0.9.2 Download postgres 0.9.2 archive
0.9.1 Oct 14, 2016 Go to the documentation of postgres 0.9.1 Download postgres 0.9.1 archive

All 11 versions...


We analyzed this package on May 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.54.0
  • pana: 0.10.6


Describes how popular the package is relative to other packages. [more]
81 / 100
Code health derived from static analysis. [more]
95 / 100
Reflects how tidy and up-to-date the package is. [more]
40 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, other

Primary library: package:postgres/postgres.dart with components: io.


  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 errors 15 hints.

    Strong-mode analysis of lib/src/query.dart failed with the following error:

    line: 129 col: 27
    The argument type 'int' can't be assigned to the parameter type 'FutureOr<T>'.

    Run dartfmt to format lib/postgres.dart.

    Similar analysis of the following files failed:

    • lib/src/client_messages.dart (hint)
    • lib/src/connection.dart (hint)
    • lib/src/connection_fsm.dart (hint)
    • lib/src/exceptions.dart (hint)
    • lib/src/message_window.dart (hint)
    • lib/src/postgresql_codec.dart (hint)
    • lib/src/server_messages.dart (hint)
    • lib/src/substituter.dart (hint)
    • lib/src/transaction_proxy.dart (hint)
  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use postgres.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <2.0.0
crypto ^2.0.0 2.0.3
Transitive dependencies
charcode 1.1.1
collection 1.14.9
convert 2.0.1
typed_data 1.1.5
Dev dependencies
test >=0.12.0 <0.13.0