MANISH MAHESH TALREJA
3 min readMay 23, 2021

--

FLUTTER UWP - FLUTTER SUPPORT FOR UWP

FLUTTER + UWP

Flutter : Flutter is an open-source UI software development kit created by Google. It is used to develop cross platform applications for Android, iOS, Linux, Mac, Windows, Google Fuchsia, and the web from a single codebase.

UWP : Universal Windows Platform is a computing platform created by Microsoft and first introduced in Windows 10. The purpose of this platform is to help develop universal apps that run on Windows 10, Windows 10 Mobile, Xbox One and HoloLens without the need to be rewritten for each.

On 19 May 2021, the second day of Google I/O, along with many great changes, Flutter announced its Windows UWP desktop support in an alpha release, available on the dev channel of Flutter.

To get started with Windows UWP you need to be using Windows 10. You need to install Visual Studio (not Visual Studio Code) with the “Universal Windows Platform development” workload and the optional Windows UWP C++ tools.

To configure Flutter for Windows UWP development, perform the following commands to switch to the dev channel, upgrade Flutter, and enable Windows UWP desktop support.

PS C:\> flutter channel dev
PS C:\> flutter upgrade
PS C:\> flutter config --enable-windows-uwp-desktop

To create a new application, run the following commands:

PS C:\> flutter create myapp
PS C:\> cd myapp

Running Flutter with Windows UWP is complicated due to UWP’s sandboxed runtime. You need to run an override for the sandbox to enable the injection of Dart code into the running UWP process to enable debugging and Hot Reload.

The suggested approach during development is to first run flutter run -d winuwp from the command line, which will give you a command that you need to run from a PowerShell with Administrator privileges.

PS C:\myapp> flutter run -d winuwp
Launching lib\main.dart on Windows (UWP) in debug mode...
LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification [C:\src\flutter-projects\myapp\build\winuwp\runner_uwp\app.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets(3327,5): warning : APPX4001: Build property AppxBundlePlatforms is not explicitly set and is calculated based on currently building architecture. Use 'Create App Package' wizard or edit project file to set it. [C:\src\flutter-projects\myapp\build\winuwp\runner_uwp\app.vcxproj]
Building Windows UWP application...
Enable Flutter debugging from localhost.
Windows UWP apps run in a sandboxed environment. To enable Flutter debugging
and hot reload, you will need to enable inbound connections to the app from the
Flutter tool running on your machine. To do so:
1. Launch PowerShell as an Administrator
2. Enter the following command:
checknetisolation loopbackexempt -is -n=[APP_CONTAINER_NAME]
Press "Y" once this is complete, or "N" to abort.:

Run this checknetisolation command as shown in a PowerShell as Administrator. You can then leave this process running for the length of your development session, restarting your UWP app as required.

PS C:\> checknetisolation loopbackexempt -is -n=[APP_CONTAINER_NAME]Network Isolation Debug Session started.
Reproduce your scenario, then press Ctrl-C when done.

Once you have this process running, you can deploy to Windows UWP from within your IDE as normal, or run from the command line as follows:

PS C:\myapp> flutter run -d winuwp

Once you have completed devloping the app, you can also release it on microsoft store by running the following command.

PS C:\myapp> flutter build winuwp

THANKING YOU

MANISH MAHESH TALREJA

ANDROID JAVA, FLUTTER, FIREBASE, UWP DEVELOPER

--

--

MANISH MAHESH TALREJA

ANDROID JAVA DEVELOPER, ALSO WORKED ON FLUTTER, WITH A WIDE KNOWLEDGE OF GOOGLE FIREBASE DATABASE AND PHP BACKEND DATABASE HANDLING.