google / flutter-desktop-embedding

Experimental plugins for Flutter for Desktop
Apache License 2.0
7.1k stars 608 forks source link

[windows]How to run flutter-desktop-embedding-project as a webApp #682

Closed hxse closed 4 years ago

hxse commented 4 years ago

When i download example project and run it. It worked very well. Further when I tried to run flutter create . to run this example project as a webApp. Report an error: Sorry, unable to detect the type of project to recreate. Try creating a freshproject and migrating your existing code to the new project manually. So, How can I solve this problem?

stuartmorgan commented 4 years ago

Further when I tried to run flutter create . to run this example project as a webApp. Report an error: Sorry, unable to detect the type of project to recreate. Try creating a freshproject and migrating your existing code to the new project manually.

This is become there's no ios or android directory in the desktop example, and the flutter tool currently relies on those for project type detection.

I'm not sure why you want to do this, since the desktop example is just the default Flutter app template, minimally changed to run on desktop. If you want to see the default Flutter example application run on web, just flutter create a new project and run it on web. If your goal is to make a new project that runs on desktop in addition to other platforms, you should create it as normal and then follow these instructions. The example here does things that would be poor practice in that context, like unconditionally changing the target platform (vs. doing it only for unsupported desktop platforms), so shouldn't be used for that purpose.

Closing, as having the apps in this repo set up to run on anything other than desktop is a non-goal.