MOTOSHARE 🚗🏍️
Turning Idle Vehicles into Shared Rides & Earnings

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Owners earn. Renters ride.
🚀 Everyone wins.

Start Your Journey with Motoshare

Migrate your Flutter App to Flutter Web

If you find yourself intrigued by the possibilities of harnessing Flutter’s web app capabilities to launch your impressive Flutter application on the web, you’ve come to the perfect spot! Here at Nuclei, we’re boldly expanding our horizons and enhancing our fintech products by embracing the online

In prior iterations of Flutter, it was essential to import an external package called “flutter_web” to enable web functionality. This often resulted in a multitude of challenges. However, in the latest iterations of Flutter, the Flutter web project has been seamlessly integrated into the core Flutter project. Consequently, the impressive Flutter features you’ve harnessed to develop your exceptional app now seamlessly extend to the web with only minor adjustments needed. This article is dedicated to assisting you in the process of adapting your Flutter application to ensure its optimal performance on the web, while also providing guidance on configuring the appropriate port and hostname for your web application

  • First , we gotta make sure that we are either on the flutter `beta` channel or the master channel.
  • Lets open a terminal and switch to the beta channel 
flutter channel beta
flutter upgrade

Then we enable the support for web by adding into flutter’s configuration :

flutter config --enable-web
  • To get a list of all the available config options , just enter
    flutter config -h command.

If the web support was successful , you should see 2 devices listed when you run flutter devices one is the Chrome device and another is Web Server device.

flutter devices
2 connected device:
Chrome • chrome • web-javascript • Google Chrome 78.0.3904.108
Web Server • web-server • web-javascript • Flutter Tools

You can run your app directly on chrome by selecting the chrome device in your IDE before you run the app or use the following command

flutter run -d chrome
If you want to run it from some external web browser client or something else , it makes sense to just run the web server in which case you would do :
flutter run -d web-server

Well , if you get errors when building your app which complains that it’s not a web app, you just need to run the flutter create command on your project folder. Open the root of your project folder in a terminal and run :





flutter create .

[ There might also be a need to run it with the --org option sometimes : flutter create . --org com.exampleapp . Also make sure that your project folder name is made of only lower case letters and underscore]

Specify custom port and hostname :

Your app by default runs on localhost ( 127.0.0.1 ) which means you can’t access it from any other device on your network. If also uses a random port every time you run your app which is not what you want most of the time.
So , let’s fix this.

  • Set the port using the --web-port option and set a globally accessible hostname ( 0.0.0.0 ) using the --web-hostname option like so when you run your app :
flutter run -d chrome --web-port 55555 --web-hostname 0.0.0.0

Now you can access your web app by opening any web browser in any of your devices in your local network by entering the following address :

http://<your-ip-address>:55555
http://192.168.0.100:55555

If you are running the web app from your IDE (Android studio or VScode) , you can specify the port and hostname by specifying the additional arguments option on Android Studio like so inside the Run Configurations

If you are using VSCode 🎊 , then you can set it in the launch.json options.

{
	"name": "Flutter",
	"request": "launch",
	"type": "dart",
	"args": ["--web-port", "55555" , "--web-hostname","0.0.0.0"]
}

Build and DEPLOY ! ! !

Now that you have converted your app into a web app , its time to build it and deploy it on free static web hosting services like netlify.com or surge.sh . To build your web app , run the following command in your project.

 flutter build web

This will create the build/web folder which you can deploy later.

Related Posts

Advance Your DevOps Career with Prometheus and Grafana Skills

In today’s fast-paced DevOps environment, system monitoring and real-time data visualization have become vital to ensuring the performance and reliability of applications. Among the leading tools trusted…

Master Observability: Prometheus and Grafana Certification at DevOpsSchool

As modern systems evolve into microservices and distributed architectures, businesses of all scales seek reliable solutions for monitoring and visualization. Among today’s most critical skills for DevOps,…

Unlock Global Recognition with DevOpsSchool’s Certification

Proudly recognized as a top-tier platform for professional upskilling, DevOpsSchool offers a unique physical certification program that affirms expertise across 80+ technologies—from DevOps and Cloud to Automation,…

Eliminate Ops: NoOps Foundation Training Deep Dive

The IT world is racing toward complete automation, and NoOps is leading the charge. This innovative approach promises to make traditional operations obsolete by embedding intelligence and…

Master NoOps: A Guide to the Foundation Certification

You’ve mastered DevOps. You’ve streamlined CI/CD pipelines and embraced a culture of collaboration. But the industry never stands still. The next evolutionary step is already here, and…

Streamline Your ML Journey: The Power of MLOps Certification

The intersection of machine learning and streamlined operations is quickly redefining how tech-forward organizations build, deploy, and govern their AI solutions. One credential stands apart in this…

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x