Compiling with Visual Studio

For most apps, it’s sufficient to allow Flutter to
handle the compilation process using the flutter run
and flutter build commands. If you are making significant
changes to the runner app or integrating Flutter into an existing app,
you might want to load or compile the Flutter app in Visual Studio itself.

Follow these steps:

Run flutter build windows to create the build\ directory.

Open the Visual Studio solution file for the Windows runner,
which can now be found in the build\windows directory,
named according to the parent Flutter app.

In Solution Explorer, you will see a number of projects.
Right-click the one that has the same name as the Flutter app,
and choose Set as Startup Project.

Run Build / Build Solution (or press Ctrl+Shift+B)
to generate the necessary dependencies.
You should now be able to run Debug / Start Debugging
(or press F5) to run the Windows app from Visual Studio.