Home

Awesome

flutter_pi_sensor_tester

This project is built upon dart_periphery and flutter-pi for running Flutter on the Raspberry Pi.

User interface

alt text

Test setup with a Raspberry Pi 3 with attached LEDs, sensors and a small touch screen running the led demo.

alt text

Video snippet for reordering UI elements

Supported devices

Technical Overview

This subproject of dart_periphery based on flutter-pi implements an isolate/stream architecture designed to transfer sensor data from an isolate to the Flutter UI.

Isolate Interface: This consists of the steps InitTask, MainTask, and ExitTask, along with a limited back channel for controlling the isolate. This setup is typically used for sensor measurements:

Listening Mode: Features InitTask and user-defined handling for isolate events. This variant remains on standby for data; once data is processed, the result is passed to the stream and subsequently to the Flutter UI. This model is used for actuator control, such as operating an LED.

Support for Multiple Streams: Enables handling of multiple data streams simultaneously.

Import hints:

Dart isolates: Starting from version 0.9.7, the default library handling mechanism creates a temporary library file, named in the format pid_1456_libperiphery_arm.so. The unique process ID for each isolate prevents repeated creation of the temporary library, avoiding crashes caused by overwriting an actively used library.

Library setup override methods, such as:

void useSharedLibray();
void setCustomLibrary(String absolutePath);

must be called separately within each isolate. This is necessary because each isolate initializes Dart Periphery independently.

Dart periphery temporarily stores a copy of the c-periphery library in the system’s temp directory. If an isolate attempts this initialization again without the reuseTmpFileLibrary(true) setting, it will cause the application to crash, with no opportunity to catch the error.

As an alternative solution, you can use void loadLibFromFlutterAssetDir(bool load) to address this issue. For more details, refer to the documentation here.

Starting The isolate related code can be found here:

Next steps: