⚠️ NOTE: This is a fairly new project. Functionally everything is working on tested Nerves systems.
NervesFlutterSupport is the base library for running Flutter based UI applications on Nerves devices.
NervesFlutterSupport contains the following components:
- Pre-compiled and patched runtime libraries for various dependencies. (See
builder/
for more info.)- Including a pre-compiled version of Sony's open source Flutter Embedder.
- A Mix Release Step that can be included in your existing Mix project.
- Takes care of downloading the Flutter embedder and runtime libraries.
- Will automatically compile your Flutter project using the
gen_snapshot
tool and output an AOT build.
NervesFlutterSupport.Flutter.Engine
- A module to create a Muontrap child_spec for running the embedder.NervesFlutterSupport.Udev
- (Automatically started for you) A module that ensureeudevd
is running for input devices to function properly.
NervesFlutterSupport has been tested on the following platforms:
- Raspberry Pi 4
- Raspberry Pi 5
However it should be noted that any aarch64 based Nerves System should be compatible with this library.
Please file any issues if you run into any problems with your ARM64 platform. We also welcome Buildroot config contributions for other platforms.
Currently we only support Linux and macOS hosts when building firmware. Windows users should use WSL.
If you are a macOS user, please ensure you have docker
installed!
- Install Flutter. See the top of this readme file for which version to use. (Flutter versions may change with Hex package versions!)
- Create a new Flutter app in your Mix project using:
flutter create flutter_app
. - Add this package to your
deps
inmix.exs
. - Add the release step to your existing firmware's
steps:
member:
steps: [
&Nerves.Release.init/1,
&NervesFlutterSupport.BuildFlutterApp.run/1, # Add Me!
:assemble
],
- Run
mix firmware
as you normally would, if all is well, you should see you Flutter app build and emit a bundle into yourpriv/
directory. - To run the Flutter app you can add the following to your
Application
orSupervisor
children:
# With no options, your Flutter app bundle is expreted to be in `priv/flutter_app`
NervesFlutterSupport.Flutter.Engine.create_child(
app_name: :my_flutter_app,
)
Example Project: NervesFlutterExample
NervesFlutterExample
is a basic Flutter + Nerves firmware for :rpi4
and :rpi5
targets. It uses
gRPC and Protobufs to communicate between the Nerves firmware code and the Dart Flutter application.