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

Master DevOps with the Ultimate Cheat Sheet from Experts

In the dynamic realm of software engineering and IT operations, efficiency and accuracy are paramount. Professionals are consistently required to navigate a complex ecosystem of tools, languages,…

Master Bitbucket: Expert Training & Certification

In the rapidly evolving world of software development, effective version control and streamlined CI/CD processes are critical for delivering high-quality applications at scale. Bitbucket, Atlassian’s robust repository…

Master Bash Scripting for DevOps and Automation

In the architecture of contemporary IT operations, automation is the cornerstone of efficiency, reliability, and scalability. While numerous tools and platforms promise automation, the foundational skill that…

Azure Training & Certification : Master Cloud Skills with Hands-On Labs

The cloud revolution is here, and Microsoft Azure is leading the charge. With enterprises worldwide shifting to scalable, secure, and intelligent cloud solutions, Azure has become the…

Master Azure DevOps: Your Guide to a Future-Proof Career in Tech

Feeling stuck in your tech career? Watching the industry evolve while you’re left working with outdated tools and processes? You’re not alone. Many talented developers, system admins,…

Ultimate AWS Certification Training Online: Master Cloud

In a world where businesses rely on speed, scalability, and security, Amazon Web Services (AWS) has become the foundation of modern cloud infrastructure. From startups launching their…

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