Flutter on Raspberry Pi (snapp_installer)

Payam Zahedi
Snapp Embedded
Published in
6 min readOct 5, 2023

By: Moritz Theis and Payam Zahedi

You may be familiar with Flutter as a versatile framework for crafting stunning mobile and web applications. Its popularity has soared among developers due to its simplicity, flexibility, and ability to deliver visually appealing, cross-platform experiences. But here are some questions worth pondering:

  • Can you harness the potential of Flutter to create applications for smaller, resource-constrained devices like the Raspberry Pi?
  • Can we use the Raspberry Pi to run our app in kiosk mode?

In this article, we will embark on a journey to answer these questions and introduce you to a revolutionary tool that makes it all possible. Get ready to explore the fusion of Flutter and Raspberry Pi as we delve into the world of snapp_installer, a command-line tool designed to simplify your development process and open doors to an entirely new realm of possibilities.

** IMPORTANT NOTE **: In an effort to rebrand our product, we have recently changed its name. As a result, in the videos, you may come across references to the old naming.

Flutter on Linux

You may already be aware that various Linux distributions can be installed on your Raspberry Pi. The Raspberry Pi OS, previously known as Raspbian, is a popular choice among users. What’s even more exciting is that Flutter extends its support to Linux GTK, enabling you to seamlessly run your Flutter applications on your Raspberry Pi. But how can you achieve this?

It’s important to note that running Flutter on a Raspberry Pi can be a bit tricky, especially if you are new to the process. But don’t worry! We’ve developed a command-line tool designed to simplify this process and make it exceptionally easy.

Overview

snapp_installer is a versatile command-line tool, essentially a bash script, designed to simplify your Flutter experience on Raspberry Pi. With snapp_installer, you can effortlessly manage your Flutter installation and development environment, and unleash the full potential of your Raspberry Pi. Here’s a quick overview of its capabilities:

  • doctor: Verify installation status and check dependencies.
  • install: Streamline the installation of Flutter and configure your development environment.
  • uninstall: Easily remove Flutter from your system.
  • kiosk: Run your Flutter app bundle in kiosk mode, transforming your Raspberry Pi into a dedicated, full-screen display.
  • disable_kiosk: Disable the kiosk mode when you need your Raspberry Pi for other purposes.
  • autologin: Enable auto-login functionality on your device, enhancing the seamless startup of your Flutter applications.
  • disable_autologin: When necessary, disable auto-login to regain control over your Raspberry Pi’s login process.

The complete source code for snapp_installer is available on GitHub. If you find it useful, we’d appreciate your support with a star.

Install snapp_installer

To quickly install snapp_installer on your Raspberry Pi, follow these straightforward steps:

  1. Open a Terminal: Launch a terminal on your Raspberry Pi. You can typically find the terminal application in your application menu.
  2. Run the snapp_installer: Copy and paste the following command into your terminal and press Enter:
bash <(curl -fSL https://snappembedded.io/installer) && source ~/.bashrc

3. Let snapp_installer Work Its Magic: Sit back and relax as our installer handles the installation process for itself. It will ensure that snapp_installer is correctly set up on your Raspberry Pi.

Install the snapp_installer command line tools

Doctor command

The “snapp_installer doctor” command is your diagnostic tool to verify the installation status and check dependencies for both your development environment and kiosk mode setup. It ensures that your Raspberry Pi is ready to support your Flutter development, and capable of running applications in kiosk mode seamlessly.

To use the “snapp_installer doctor” command, open your terminal and enter:

snapp_installer doctor
snapp_installer doctor command

Install flutter environment

The “install” command in snapp_installer automates the installation of Flutter on your Raspberry Pi and prepares the environment for Flutter app development. Here’s a breakdown of what it does:

  1. Installs Linux Dependencies: Ensures that essential Linux packages, including curl, git, and more, are installed on your Raspberry Pi.
  2. Clones Flutter from GitHub: Fetches the Flutter repository from GitHub and places it in your specified directory.
  3. Sets Up PATH: Configures your system’s PATH environment variable to include the Flutter binary directory, making the flutter command globally executable.
  4. Installs Development Dependencies: Installs necessary Linux development dependencies required for Flutter app development, including compilers and libraries.
  5. Chooses Flutter Channel: Allows you to specify your preferred Flutter channel (e.g., stable, beta) to ensure you’re using the desired Flutter release.
  6. Runs Flutter Doctor: This command checks your Flutter installation and displays any missing components or configuration issues.
  7. Precaches Assets: Precaches Linux-specific assets, ensuring a smooth development experience.

To use the “install” command, simply run the following command:

snapp_installer install

This will streamline the installation process and set up your Raspberry Pi for Flutter development effortlessly.

snapp_installer install flutter command

Kiosk mode

snapp_installer offers you the ability to run your Flutter app in kiosk mode on your Raspberry Pi, delivering a seamless and focused user experience. To enable kiosk mode, simply follow these easy steps:

1- Build Your Flutter App: Ensure you have built your Flutter app for the Linux platform in release mode. You can generate the app bundle using the following command:

flutter build linux --release

2- Enable Kiosk Mode: To run your Flutter app in kiosk mode, utilize the following command, replacing <file_path> with the exact path to the Flutter app bundle you built in step 1:

snapp_installer kiosk <file_path>

For example:

snapp_installer kiosk /home/pi/app/build/linux/arm64/release/bundle/app
  • Ensure that the specified file path exists, points to an executable file, and is the path to your Flutter app bundle.

3- Auto Login: Kiosk mode typically requires auto-login on your Raspberry Pi. If auto-login is not already enabled, snapp_installer will enable it for you. Alternatively, you can manually enable auto-login using the following command:

snapp_installer autologin

Please note that enabling kiosk mode may alter the default behavior of your Raspberry Pi desktop environment. Ensure you have a backup or SSH access to your Raspberry Pi in case adjustments are needed.

Disabling kiosk mode

If you wish to disable kiosk mode and return your Raspberry Pi to a standard desktop environment, follow these steps:

  1. Exit Full-Screen Mode: If your Raspberry Pi is currently in full-screen kiosk mode, exit this mode by pressing Alt+F4 (to close the app) or F11 (to exit full-screen mode).
  2. Disable Kiosk Mode: Open a terminal on your Raspberry Pi and execute the following command to disable kiosk mode:
snapp_installer disable_kiosk

This command will remove the kiosk-related settings and restore your desktop environment.

Conclusion

We’ve unveiled the potential of uniting Flutter and Raspberry Pi using snapp_installer. This tool simplifies Flutter development on the Raspberry Pi, enabling the creation of tailored applications while offering kiosk mode for immersive user experiences.

With snapp_installer, complex installations become a breeze, making Flutter accessible to developers of all levels. Whether you’re a seasoned pro or a newcomer, this tool is your ally.

We’ve shown you how to install Flutter, configure your environment, and activate kiosk mode seamlessly. As you venture into the world of Flutter on Raspberry Pi, remember that snapp_installer is here to assist you at every turn.

We’d love to hear about the first project you plan to create using snapp_installer.

--

--

Payam Zahedi
Snapp Embedded

I’m a Software Engineer, Flutter Developer, Speaker & Open Source Lover. find me in PayamZahedi.com