flutterdarttestingmobileflutter-web

View Flutter web on mobile


I am building a flutter web app, but I want it to behave differently on mobile and desktop. To test it, is it possible to run the web app on a phone's browser or in the browser of an emulator? Thanks


Solution

  • Yes, testing your code in a web browser while in production is possible. Here are steps to do that:

    t

    flutter run -d web-server --web-port 8080 --web-hostname 0.0.0.0
    

    Then, head to your mobile phone browser and type

    HTTP://<your PC IP address>:8080
    

    Testing in my phone browser

    Testing in my Mac browser