By default, each time you start Flutter web on localhost, it will have a different port. However, there are cases where you need to set up a fixed, unchanged port (like when you want to implement social auth with Google Sign-In). To do that, use the –web-port flag when running your project like so:
flutter run -d chrome --web-port=10000
Screenshot:
That’s it. Further reading:
- How to create a gradient background AppBar in Flutter
- Flutter Web: 2 Ways to Change Page Title Dynamically
- Flutter web: Removing hash symbol (#) from all URLs
- Flutter: Making Beautiful Chat Bubbles (2 Approaches)
- Create a Custom NumPad (Number Keyboard) in Flutter
- Flutter: Creating a Custom Number Stepper Input
You can also take a tour around our Flutter topic page and Dart topic page to see the latest tutorials and examples.