Flutter Desktop today: what is stable and what is not
Flutter compiles native apps for Windows, macOS and Linux with the same Dart code as mobile, and the supported platforms page (referring to Flutter 3.50, accessed 2026-11-12) says precisely where. The parts that many articles treat as solved are in fact the most uncertain: multiple windows do not yet have a stable API, the plugins for the system tray and for window management change version quickly, and packaging requires a different tool for each system, to be run on that system. This article separates what I could run (FFI on Linux, widget analysis) from what depends on a platform or a Flutter version that is not available here.
| System | Supported versions | Not supported |
|---|---|---|
| Windows (x64, Arm64) | 10 and 11 (tested in CI: 10) | 8 and earlier |
| macOS (x64, Arm64) | from Monterey (12) to Golden Gate (27); tested: Sequoia (15) and Tahoe (26) | Big Sur (11) and earlier |
| Debian (x64, Arm64) | from 10 to 13 (tested: 12) | 9 and earlier |
| Ubuntu (x64, Arm64) | from 20.04 LTS to 24.04 LTS (tested: 22.04 LTS) | non-LTS versions up to 25.10 |
The table contradicts two very widespread figures: Windows 7 and macOS 10.15 are not the minimum, and on Linux there is no "kernel 5.10" requirement on the official page. There is also a warning to keep in mind for anyone distributing on Mac: the same page writes that macOS Tahoe (26) is the last version for Intel Macs and that Golden Gate (27) will require Apple Silicon. If your audience still uses Intel Macs, the support window is already dated.
To add the three targets to an existing project you use flutter create --platforms=windows,macos,linux .
(desktop guide), which generates the
windows/, macos/ and linux/ folders with the surrounding native code. That
native code is yours: you will modify it when you need to register plugins or add windows, as we will see.
Calling a native function with FFI
The problem: the operating system offers functions that Flutter does not expose (the length of a string in
bytes, a system message, a low-level network call). With dart:ffi you call them
directly from Dart, without writing a platform channel. The difference from the channels you find in
Platform Channels is that here there is no
intermediate Swift, Kotlin or C++ code: you declare the C signature and Dart loads the function by name.
The listing below runs on Linux and uses the C library already loaded in the process. It does two useful
things to learn: it converts a Dart string into a UTF-8 copy with toNativeUtf8 (which belongs to
the ffi package, not to dart:ffi) and frees it with calloc.free.
import 'dart:ffi';
import 'dart:io' show pid;
import 'package:ffi/ffi.dart';
// C signatures: size_t strlen(const char*) and int getpid(void)
typedef _StrlenC = IntPtr Function(Pointer<Utf8>);
typedef _StrlenDart = int Function(Pointer<Utf8>);
typedef _GetpidC = Int32 Function();
typedef _GetpidDart = int Function();
void main() {
final libc = DynamicLibrary.process(); // libc is already loaded in the process
final strlen = libc.lookupFunction<_StrlenC, _StrlenDart>('strlen');
final getpid = libc.lookupFunction<_GetpidC, _GetpidDart>('getpid');
const text = 'perché';
final native = text.toNativeUtf8(); // UTF-8 copy outside the Dart heap
try {
print('Dart characters : ${text.length}');
print('bytes for C : ${strlen(native)}');
} finally {
calloc.free(native); // without this line the memory never comes back
}
print('same pid as dart:io? ${getpid() == pid}');
}
// Output:
// Dart characters : 6
// bytes for C : 7
// same pid as dart:io? true
The output contains the main lesson: "perché" (the Italian word for "why") has 6 characters for Dart and 7
bytes for C, because the accented letter takes two bytes in UTF-8. Anyone passing lengths from one world
to the other without noticing produces truncated buffers. The calloc.free(native) line is in
the finally block because memory allocated outside the Dart heap is never reclaimed by the
garbage collector: forgetting it is a leak that grows with every call. The last line compares C's
getpid with the pid of dart:io, and shows that you are really talking
to the operating system.
On Windows the same pattern calls system APIs without compiling anything: just open
user32.dll and look up MessageBoxW, which takes 16-bit strings (Utf16).
I did not run this block because it requires Windows: it is self-contained code that the analyzer accepts, its
output (the user's choice in the window) is deduced and not observed.
import 'dart:ffi';
import 'package:ffi/ffi.dart';
// int MessageBoxW(HWND, LPCWSTR text, LPCWSTR caption, UINT type)
typedef _MessageBoxC = Int32 Function(IntPtr, Pointer<Utf16>, Pointer<Utf16>, Uint32);
typedef _MessageBoxDart = int Function(int, Pointer<Utf16>, Pointer<Utf16>, int);
int showMessageBox(String title, String text) {
final user32 = DynamicLibrary.open('user32.dll');
final messageBox = user32.lookupFunction<_MessageBoxC, _MessageBoxDart>('MessageBoxW');
final t = title.toNativeUtf16();
final m = text.toNativeUtf16();
try {
const mbOkCancel = 0x00000001;
return messageBox(0, m, t, mbOkCancel);
} finally {
calloc.free(t);
calloc.free(m);
}
}
Compared with the version found in many tutorials, which creates a C++ file with MessageBoxA and
compiles it with CMake, here you do not need to touch the windows/ folder. You write native code only
when the function you need does not already exist in a system library; the
"Direct C interop with dart:ffi" guide describes this
case and the native interoperability overview helps to
choose between FFI, Pigeon and the other tools. The same guide warns about a trap for the interface:
FFI calls are synchronous and run on the thread that invokes them, so a slow C function called from the
main thread blocks the screen and drops frames; slow calls must be run in an
isolate with Isolate.run.
Menus, shortcuts and close with confirmation
A desktop app is used with mouse and keyboard, so it needs menus and shortcuts. Here a frequent
confusion has to be corrected. Material's MenuBar widget draws a menu inside the window and
works on any platform. PlatformMenuBar instead uses the system's native menu, but the
API documentation warns
that Flutter supports it only on macOS; for the other platforms you need a plugin. If you want a single
code base, MenuBar plus CallbackShortcuts is the combination you can use everywhere.
For close with confirmation you do not need a plugin: AppLifecycleListener accepts an
onExitRequested callback, described as the way to decide whether the application can exit in
the cases where exit can be cancelled. The callback returns AppExitResponse.cancel or
AppExitResponse.exit.
import 'dart:ui' show AppExitResponse;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// In-window menu (works on all desktops) plus keyboard shortcut.
class DesktopShell extends StatefulWidget {
const DesktopShell({super.key, required this.onSave, required this.hasUnsavedChanges});
final VoidCallback onSave;
final bool Function() hasUnsavedChanges;
@override
State<DesktopShell> createState() => _DesktopShellState();
}
class _DesktopShellState extends State<DesktopShell> {
late final AppLifecycleListener _lifecycle;
@override
void initState() {
super.initState();
_lifecycle = AppLifecycleListener(onExitRequested: _confirmExit);
}
Future<AppExitResponse> _confirmExit() async {
if (!widget.hasUnsavedChanges()) return AppExitResponse.exit;
final save = await showDialog<bool>(
context: context,
builder: (context) => AlertDialog(
title: const Text('Unsaved changes'),
content: const Text('Do you want to save before closing?'),
actions: [
TextButton(
onPressed: () => Navigator.pop(context, false),
child: const Text('Close without saving'),
),
TextButton(
onPressed: () => Navigator.pop(context, true),
child: const Text('Save and close'),
),
],
),
);
if (save == null) return AppExitResponse.cancel; // dialog dismissed: stay open
if (save) widget.onSave();
return AppExitResponse.exit;
}
@override
void dispose() {
_lifecycle.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
// Cmd+S on macOS, Ctrl+S elsewhere.
final saveKey = defaultTargetPlatform == TargetPlatform.macOS
? const SingleActivator(LogicalKeyboardKey.keyS, meta: true)
: const SingleActivator(LogicalKeyboardKey.keyS, control: true);
return CallbackShortcuts(
bindings: {saveKey: widget.onSave},
child: Focus(
autofocus: true,
child: Column(
children: [
MenuBar(
children: [
SubmenuButton(
menuChildren: [
MenuItemButton(
onPressed: widget.onSave,
shortcut: saveKey,
child: const Text('Save'),
),
],
child: const Text('File'),
),
],
),
const Expanded(child: Center(child: Text('Document'))),
],
),
),
);
}
}
Three lines do the work. In initState the listener is created with _confirmExit;
in dispose it is destroyed, otherwise it would stay attached to the binding even after the
widget is closed. In _confirmExit the null answer of the dialog (the user closes it without
choosing) becomes cancel: the app stays open, which is the prudent choice. The shortcut uses
meta on macOS and control elsewhere because Cmd+S and Ctrl+S are the conventions of the two families.
I did not run the app: flutter analyze reports no problems, but when the window close
actually reaches the callback depends on the system, and must be tried on each of the three.
Multiple windows: the real state of things
It pays to be clear here, because much of the literature presents multiple windows as a solved
problem. On this machine the stable SDK (Flutter 3.44.2) exposes the
--enable-windowing option with the note "this setting only applies to the master channel"
(I read it in flutter config --help), and the official discussion
"Support multiple windows for desktop shells"
is still open (last updated 2026-09-05, accessed 2026-11-12). So a framework API for multiple windows
exists, but it is not on the stable channel of this version. The page of the window_manager
0.7.0 package already refers to this API and requires Flutter 3.50, which I have not
installed: that is why the plugin code that follows is a pattern, not a compiled listing.
Until an official solution arrives, the reference point is the
desktop_multi_window plugin (version 0.3.1, published 2026-08-26), which opens a new window
with its own Flutter engine. From its README:
// desktop_multi_window 0.3.1: pattern taken from the README, not run
final controller = await WindowController.create(
WindowConfiguration(
hiddenAtLaunch: true,
arguments: 'inspector', // the new window reads this text at startup
),
);
await controller.show();
The arguments parameter is the only data handed over when the window is born: the new window
reads it and decides what to draw. The fact that each window has its own engine, stated by the README, has
practical consequences worth knowing before designing:
- Each window has its own isolate and its own state: a global variable is not shared.
- Platform channels are not shared between engines, so plugins must be registered by hand for each new window, by modifying the native code in
windows/,macos/andlinux/. - Communication between windows goes through a dedicated channel (
WindowMethodChannel), with serialized messages.
In practice the architecture that works is one where each window is almost autonomous and talks to the others through messages, and the "centralized manager with shared state" that shows up in many examples is not achievable with this model. If you need a palette in one window and a drawing area in another, continuous synchronization is a project cost, not a detail. I did not measure the memory cost of one engine per window and I do not write a figure for it.
System tray icon
The tray_manager package (0.9.0, published 2026-11-12) manages the icon in the notification area. Its
README flags an exception that surprises developers: on Linux the icon is a
StatusNotifierItem and needs a panel to host it; KDE Plasma and most
environments do, GNOME only with the AppIndicator extension (enabled by default on Ubuntu).
On Linux, moreover, the README states that clicks on the icon are not reported. The package requires
the same recent Flutter version as window_manager, so here too I have no compiled code
to show you: if you need the tray, design the feature so that the app is usable even without it.
Packaging: one format, one tool, one system
To hand an app to a user, the flutter build folder is not enough. Each system has its own
format and its own tool, and each is run on that system: you cannot produce an MSIX from Linux.
The commands in the listing below come from the documentation of the two tools; I did not run them because
they require Windows or macOS (and, for the DMG, an installation of appdmg with npm).
| System | Format | Tool | What else you need |
|---|---|---|---|
| Windows | MSIX | msix package (3.18.0) | a Windows machine; for the Store a certificate and the publisher field |
| macOS | DMG | Fastforge | appdmg installed with npm |
| Linux | AppImage | Fastforge | appimagetool on the program path |
Beware of the names: guides that use dart run create_dmg or dart run appimage_bundle
cite packages that do not exist on pub.dev (the two searches of 2026-11-12 returned "not found"); the real
tools are the ones in the table. For Windows the configuration lives in pubspec.yaml.
dev_dependencies:
msix: ^3.18.0
msix_config:
display_name: My App
publisher_display_name: Company name
identity_name: it.example.myapp
msix_version: 1.0.0.0
The four keys are the ones documented in the msix package README.
The identity_name and the publisher identify the app and who signs it: if you publish on the
Store they must match the ones assigned by the platform, otherwise the package is rejected. The
values in the example are placeholders to replace.
# Windows (from a Windows machine)
dart run msix:create
# macOS and Linux, with fastforge: appdmg (npm) and appimagetool are required
fastforge package --platform macos --targets dmg
fastforge package --platform linux --targets appimage
The first line builds the MSIX installer; the other two, documented on the Fastforge
DMG and AppImage pages,
each require a make_config.yaml file in the
macos/packaging/dmg or linux/packaging/appimage folder. This configuration is where
most time is lost: start from the examples in the documentation and change one field at a time.
Frequently asked questions
Is Windows 7 still supported?
No. The supported platforms page lists Windows 10 and 11 as supported and indicates Windows 8 and earlier as unsupported. Check the table at the start of the article before promising a version to your customers.
How much code can I share with the mobile version?
There is no credible percentage that holds for everyone. Domain logic and generic widgets are shared by construction; menus, shortcuts, windows, tray and packaging are per platform. The way to find out is to count the lines of your project after the first month, not to trust an estimate.
What you can do now
You know which versions of Windows, macOS and Linux you can declare supported, you can call a native function with FFI and free the memory, you can build menus and shortcuts that work everywhere and intercept the closing of the app. Above all you know that multiple windows today are tackled with one engine per window and messages between windows, and not with a central manager. For the web part of the same app read Flutter Web with WebAssembly; to check the screen with tests go to Widget testing and golden tests; to understand how the framework builds what you draw, to the Flutter internals.
Sources
- Supported deployment platforms - supported Windows, macOS, Debian and Ubuntu versions (Flutter 3.50), accessed 2026-11-12
- Desktop support for Flutter -
flutter create --platforms, accessed 2026-11-12 - PlatformMenuBar (Flutter API) - native menu supported only on macOS, accessed 2026-11-12
- AppLifecycleListener (Flutter API) -
onExitRequested, accessed 2026-11-12 - flutter/flutter issue 30701 - multiple window support still open, accessed 2026-11-12
- desktop_multi_window on pub.dev - one engine per window, plugin registration,
WindowController.create, accessed 2026-11-12 - tray_manager on pub.dev - StatusNotifierItem on Linux, accessed 2026-11-12
- msix on pub.dev -
dart run msix:createandmsix_configkeys, accessed 2026-11-12 - Fastforge: DMG and AppImage - requirements and commands, accessed 2026-11-12
- Direct C interop with dart:ffi -
package:ffifor strings and allocation, synchronous FFI calls,Isolate.run, accessed 2026-11-12

Commenti
Caricamento commenti...
Sign in to comment