Skip to content

Quickstart ‐ Raspberry Pi 4 Model B

Hidenori Matsubayashi edited this page Sep 23, 2023 · 2 revisions

Overview

This is a quickstart to get a hello world application (the default flutter counter app) running on Raspberry Pi 4b.

Requirements

  • Raspberry Pi 4B (not tested on other boards)
  • HEADLESS Raspbian 64bit (bullseye release 11)
  • HDMI display

Quickstart for DRM backend

Use Raspberry Pi Imager tool to set up SD card.

# dependencies
$ ssh <user>@<hostname>
$ sudo apt install curl unzip git clang cmake pkg-config -y
$ sudo apt install libegl1-mesa libgles2-mesa libxkbcommon-dev -y
$ sudo apt install libdrm-dev libgbm-dev libinput-dev libudev-dev libsystemd-dev -y
$ sudo apt install build-essential libegl1-mesa-dev libgles2-mesa-dev

# I had to do this due to being in US locale: see [this issue](https://github.com/sony/flutter-embedded-linux/issues/387).
$ sudo cp /usr/share/X11/xkb/symbols/us /usr/share/X11/xkb/symbols/US

$ git clone https://github.com/sony/flutter-elinux.git
$ sudo mv flutter-elinux /opt/
# OR add below line to ~/.bashrc
$ export PATH=$PATH:/opt/flutter-elinux/bin
$ flutter-elinux doctor

# project creation & build
$ cd ~
$ flutter-elinux create helloworld
$ cd helloworld
$ flutter-elinux build elinux --debug --target-backend-type=gbm
$ cd build/elinux/arm64/debug/bundle/

# run
$ sudo FLUTTER_DRM_DEVICE=/dev/dri/card1 ./helloworld -b ~/helloworld/build/elinux/arm64/debug/bundle

Warning: this setup may change if in a different environment or a future version of Raspbian.