database_adapter_postgre 0.2.0
database_adapter_postgre: ^0.2.0

Dart native
Flutter Android iOS

An adapter for using 'package:database' API with a PostgreSQL database.

Overview #

Provides an adapter for using the package database with PostgreSQL. The implementation relies on the package postgres.

Getting started #

1.Add dependency #

dependencies:
  database: any
  database_adapter_postgre: any

2.Configure #

import 'package:database/database.dart';
import 'package:database/sql.dart';
import 'package:database_adapter_postgre/database_adapter_postgre.dart';

Future main() async {
  final config = Postgre(
    host: 'localhost',
    port: 5432,
    user: 'your username',
    password: 'your password',
    databaseName: 'example',
  );

  final sqlClient = config.database().sqlClient;

  final result = await sqlClient.query('SELECT name FROM employee').toRows();
  for (var row in result.rows) {
    print('Name: ${row[0]}');
  }
}
3
likes
90
pub points
60%
popularity

Publisher

dint.dev

An adapter for using 'package:database' API with a PostgreSQL database.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache 2.0 (LICENSE)

Dependencies

collection, database, meta, postgres

More

Packages that depend on database_adapter_postgre