This page discusses considerations unique to building Linux apps with Flutter, including shell integration and preparation of apps for distribution.
Integrating with Linux
The Linux programming interface, comprising library functions and system calls,
is designed around the C language and ABI.
Fortunately, Dart provides
which is designed to enable Dart programs to efficiently call into C libraries.
FFI provides Flutter apps with the ability to allocate native memory
calloc, support for pointers, structs and callbacks,
and ABI types like
For more information about calling C libraries from Flutter,
see C interop using
Many apps will benefit from using a package that wraps the underlying library calls in a more convenient, idiomatic Dart API. Canonical has built a series of packages with a focus on enabling Dart and Flutter on Linux, including support for desktop notifications, dbus, network management, and Bluetooth.
Preparing Linux apps for distribution
The executable binary can be found in your project under
build/linux/<build mode>/bundle/. Alongside your
executable binary in the
bundle directory there are
libcontains the required
datacontains the application’s data assets, such as fonts or images
In addition to these files, your application also
relies on various operating system libraries that
it’s been compiled against.
You can see the full list by running
against your application. For example,
assuming you have a Flutter desktop application
linux_desktop_test you could inspect
the system libraries it depends upon as follows:
$ flutter build linux --release $ ldd build/linux/release/bundle/linux_desktop_test
To wrap up this application for distribution
you need to include everything in the
and make sure the Linux system you are installing
it upon has all of the system libraries required.
This may be as simple as:
$ sudo apt-get install libgtk-3-0 libblkid1 liblzma5
For information on publishing a Linux application to the Snap Store, see Build and release a Linux application to the Snap Store.