Quick Fix for Android Emulator Issues

If you have a an issue with your flutter application unable to use the andriod emulator, i found another way for previewing your application. Applications needed:

-OR-
flutter run -d web-server --web-port 8080

Required Applications:

  1. GitHub
  2. Flutter Package: device_preview

Steps:

  1. Push your code to and make sure it has access to github.io (Read to setup Quickstart for GitHub Pages - GitHub Docs )

  2. Use the device_preview package to wrap your runApp; *void main async { runApp(DevicePreview(builder: (context) => MyApp));} *

Accessing Your App:

  • Once your app is hosted on GitHub Pages, you can access and preview your app directly from the web.
  • To view updated changes, simply push your latest code to GitHub, and the updates will be reflected online.

not the efficient way.
your plan is to flutter build web and then push it to github pages.

what you should be doing is just:
your 2nd step then,
“flutter run -d web-server --web-port 8080”
then give public access to your chosen port. and open the forwarded url in new tab

flutter run command is way more faster than flutter build.
and with run command it supports hot restart too. so you won’t need to rebuild it everytime.

its also another way to do it…just added it…

1 Like