Running (starting) a flutter app with flask backend
You should run Flask at different port e.g. change
flask run --port 5000
toflask 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
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
stud
Updated on December 28, 2022Comments
-
stud 5 months
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 run
orflutter run -d chrome --web-port=5000
.If I had a pure flask app I would start it with
flask run
but 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 about 2 yearsIt 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 about 2 yearsIncluding to what @DivakarPatil mentioned, also you might face some troubles with CORS issues. But first, get them started, then that can be fixed.
-