Closed cardosodario closed 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();
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
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
The error message is clear, please see the Dart documentation for async/await: https://dart.dev/codelabs/async-await
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