Flutter app not connecting to PostgreSQL database in release mode

1,203

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

Share:
1,203
morita_06
Author by

morita_06

Updated on December 19, 2022

Comments

  • morita_06
    morita_06 over 1 year

    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.

    • GraSim
      GraSim almost 4 years
      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
    • morita_06
      morita_06 almost 4 years
      @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.