Home > Blockchain >  Flutter - Why is there a windows folder in my app?
Flutter - Why is there a windows folder in my app?

Time:04-29

I have a folder named windows in my Flutter app. It's also causing some C and other files to show up in source control changes.

Is it safe to delete this folder if I am not developing for windows? Why and how could it have come there?

CodePudding user response:

It is created because it is listed as one of the default platforms of the flutter create command:

% flutter --help create

...

    --platforms              The platforms supported by this project. Platform folders (e.g. android/) will be generated
                             in the target project. This argument only works when "--template" is set to app or plugin.
                             When adding platforms to a plugin project, the pubspec.yaml will be updated with the
                             requested platform. Adding desktop platforms requires the corresponding desktop config
                             setting to be enabled.
                             [ios (default), android (default), windows (default), linux (default), macos (default), web
                             (default)]
...

It is there in case you want to build your app for Windows.

Yes, you can safely delete it.

If you ever regret deleting it and want to create it back, you can write flutter create . inside your project folder.

If you do not want it in your next project, you can specify platforms to be supported while creating the project:

flutter create --platforms ios,android my_new_project

CodePudding user response:

Your project available for windows application that's why you have window folder in your project directory. If you delete it you will not able to run your application on windows.

  • Related