flutterflutter-apk

How to interact flutter apk with PostgreSQL and external website?


I created flutter app, it is using PostgreSQL as DB and opening external websites for product related info. This is working as expected in emulator. Created apk file with the command flutter build apk --build-name 1.0 --build-number 1 and installed in my mobile.

The app is not able to load data from database. Not sure I whether I missed any steps while creating the apk or other. Can someone help me?


Solution

  • try replacing your _launchURL with this :

      _launchURL(String url) async {
        final uri = Uri.parse(url);
          await launchUrl(uri, mode: LaunchMode.externalApplication); 
      }
    

    In your android/app/src/main/androidManifest.xml add this line before <application

    <uses-permission android:name="android.permission.INTERNET"/>
    

    Like this :

    enter image description here