Flutter extension¶
The Flutter family of extensions help fill in common settings for software built with the Flutter framework.
The Flutter extensions require Snapcraft 7 and lower and are currently only supported with the core18 base. Snaps using cores higher than core18 should instead use the Flutter plugin with the GNOME extension.
There are four extensions in the family. Each tracks a different Flutter build release channel:
- flutter-stablefor the stable channel
- flutter-betafor the beta channel
- flutter-masterfor the main channel
- flutter-devfor the dev channel
When using these extensions, the Flutter plugin is optional. The plugin drives the build process while the extension handles its dependencies.
Included parts¶
The Flutter extensions add the following parts to the project file. The
gnome-3-28-extension part is noteworthy, as it provides many of the dependent
components that Flutter-based apps need.
Included parts
gnome-3-28-extension:
  build-packages:
    - gcc
    - libgtk-3-dev
  make-parameters:
    - PLATFORM_PLUG=gnome-3-28-1804
  plugin: make
  source: $SNAPCRAFT_EXTENSIONS_DIR/desktop
  source-subdir: gnome
flutter-extension:
  build-snaps:
    - flutter/latest/stable
  override-pull: |
    flutter channel stable
    flutter config --enable-linux-desktop
    flutter upgrade
    flutter doctor
  plugin: nil
Included interface connections¶
The Flutter extensions connect the following snap-wide plugs.
Included snap-wide plugs
plugs:
  gnome-3-28-1804:
    default-provider: gnome-3-28-1804
    interface: content
    target: $SNAP/gnome-platform
  gtk-3-themes:
    default-provider: gtk-common-themes
    interface: content
    target: $SNAP/data-dir/themes
  icon-themes:
    default-provider: gtk-common-themes
    interface: content
    target: $SNAP/data-dir/icons
  sound-themes:
    default-provider: gtk-common-themes
    interface: content
    target: $SNAP/data-dir/sounds
They also connect the following plugs in apps that use the extensions.
Included app plugs
plugs:
  - desktop
  - desktop-legacy
  - gsettings
  - opengl
  - wayland
  - x11
Included environment variables¶
The extensions add one runtime environment variable:
Included runtime environment variables
environment:
  SNAP_DESKTOP_RUNTIME: $SNAP/gnome-platform
Included layouts¶
The Flutter extensions add the following layouts:
Included layouts
layout:
  /usr/share/libdrm:
    bind: $SNAP/gnome-platform/usr/share/libdrm
  /usr/share/xml/iso-codes:
    bind: $SNAP/gnome-platform/usr/share/xml/iso-codes
Example expanded project files¶
Here’s an example of the result of a project file that uses a Flutter extension. It demonstrates the added plugs, packages, variables, and layouts that the extension adds to the project file immediately prior to build.
This example contains the difference between the original file and the output of the snapcraft expand-extensions command. Some of the text has been altered for ease of reading.
The file is based on the my-flutter-app project.
