I’ve been working on a Flutter mobile application that connects to an API. At the beginning, I decided to run the app on Chrome instead of debugging directly on an Android or iOS device because it’s simply faster to do so.
But then I faced an annoying issue: whenever I launched the app by opening the main.dart file and clicking on the green debug button, the app would run on a different port each time. This caused CORS issues whenever my Dart app sent requests to the API, since the origin kept changing.
So I needed a way to always run the app on the same port.

