Running (starting) a flutter app with flask backend

252
  1. You should run Flask at different port e.g. change flask run --port 5000 to flask run --port 8000. This way, your Flask app will run at port 8000 and won't interfere with Flutter port, which you set to 5000 using this command: flutter run -d chrome --web-port=5000

  2. I assume, your Flutter app wants to request data from your Flask app. If it is so, you will have a lot of issues because of requesting due to Chrome's Security Policy

Share:
252
stud
Author by

stud

Updated on December 28, 2022

Comments

  • stud
    stud over 1 year

    I am very new to flutter and I am confused how I can start the app. I downloaded several examples (e.g. https://github.com/ihassanjavaid/Iris-Predictor-Flutter-Flask) but I just don't know how to start it. Having no flask in my flutter app I know I can use flutter runor flutter run -d chrome --web-port=5000.

    If I had a pure flask app I would start it with flask runbut having flask AND flutter I don't know what to do. When I try either of the said commands then either the flask stuff or the flutter stuff isn't running. Is there a way to start both at the same time?

    • Divakar Patil
      Divakar Patil about 3 years
      It seems that you are trying to run both apps on same port i.e 5000. Start flutter app on 5001 and flask app on 5000
    • Huthaifa Muayyad
      Huthaifa Muayyad about 3 years
      Including to what @DivakarPatil mentioned, also you might face some troubles with CORS issues. But first, get them started, then that can be fixed.