5

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 3

9

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
Sign up to request clarification or add additional context in comments.

1 Comment

For me this only works with -d web-server, are you certain that you can open this on your mobile browser? Also, do you get a debug connection to the instance running in the browser?
0

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

-1

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

  1. Create a new repo named username.github.io, where username is your username (or organization name) on GitHub.

  2. Just drop everything inside in web folder(from step 1) to your repo.

  3. now open your website like https://username.github.io.

2 Comments

I'm not talking abt Github, do you know the solution to my question?
@Aishwarya again the answer to your particular question is no. you can't do that because of android studio just detect platform no apps(such as chrome) inside it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.