I have created a flutter web application. While selecting a device, I saw options such as chrome and my device. I was able to run the application in both of them. But now, I want to open this web application through the chrome browser on my mobile. How to do it?
3 Answers
Yes you can. Just be sure you are on same LAN network. And then
Just run this in terminal
flutter run -d chrome --web-hostname 0.0.0.0 --web-port 55555
Now check your pc's ip address on Windows : ipconfig on Linux/Mac : ifconfig
and then on mobile browser run
http://your-local-ip(pc-ip):55555
1 Comment
Yes you can serve your web app on your local network and access it in your mobile browser provided they are connected to same network.
You could do this using port reversing, which basically redirects your localhost port request to yor systems localhost port.
So when you run your flutter web app using
flutter run -d web-server
you will see your webapp being served at localhost e.g
http://localhost:49403
- connect your phone to your device
- run
adb reverse tcp:49403 tcp:49403 - Now you can just enter the address in your phones browser and see the app running.
so when your run the adb reverse command the phones local port 49403 will be routed to your laptop’s port 49403. and you will be able to see your app running in your phones browser.
Comments
Answer is NO. But you can deploy your web app to GitHub for free.
Step 1 Read preparing a web app for release on official site.
run flutter build web on the terminal.
The release build of a simple app has the following structure:
/build/web
assets
AssetManifest.json
FontManifest.json
LICENSE
fonts
MaterialIcons-Regular.ttf
<other font files>
<image files>
index.html
main.dart.js
main.dart.js.map
Step 2 Read How to host on pages on Github read here
Create a new repo named username.github.io, where username is your username (or organization name) on GitHub.
Just drop everything inside in
webfolder(from step 1) to your repo.now open your website like https://username.github.io.