stablekernel / postgresql-dart

Dart PostgreSQL driver: supports extended query format, binary protocol and statement reuse.
https://www.dartdocs.org/documentation/postgres/latest
BSD 3-Clause "New" or "Revised" License
127 stars 32 forks source link

problem open connection with flutter 1.11.0 #107

Closed cardosodario closed 5 years ago

cardosodario commented 5 years ago

hi

i my file.dart

var connection = new PostgreSQLConnection("192.168.4.46", 5432, "redearlete", username: "loja001", password: "xxxx"); await connection.open();

when run i receive this

Compiler message: lib/pages/home.dart:30:23: Error: 'await' can only be used in 'async' or 'async*' methods. await connection.open();

how i resolv this ?

thanks

dario

Flutter 1.11.0 • channel dev • https://github.com/flutter/flutter.git Framework • revision 856a90e67c (6 days ago) • 2019-11-08 18:00:01 -0800 Engine • revision af04338413 Tools • Dart 2.7.0

itsjoeconway commented 5 years ago

The error message is clear, please see the Dart documentation for async/await: https://dart.dev/codelabs/async-await