1

I am developing an app in flutter that connects to a PostgreSQL server in a raspberry pi. Everything works fine in debug mode but when I switch to release mode, I get this error message:

PostgreSQLSeverity.error : Attempting to execute query, but connection is not open.

Here is the connection code for helping with the solution:

    static PostgreSQLConnection openConnection(){
      var connection = PostgreSQLConnection(ip, port, dbName, username: 'xxxxxxxxx', password: 'xxxxxxxx');
      connection.open();
      return connection;
  }

I don't know where to start looking for an error or something. Any idea about how to deal with this issue?

Thanks.

morita_06
  • 27
  • 9
  • Hi @morita_06, I am trying to do exactly the same as you (connect postgresql to flutter), please can you give some pointers or useful links. Thanks – GraSim Jul 21 '20 at 14:18
  • @GraSim Hi, my problem was related to the release version. Besides that, the app connected fine to PostgreSQL. The accepted answer solved my issue. I could help you, if you facilitate me any email to write to you. – morita_06 Jul 22 '20 at 16:33

1 Answers1

1

if you are connecting to your server through the Internet you need to add Internet permission in android. check this link for more info.

Payam Zahedi
  • 827
  • 7
  • 20