Cross-platform UIs with Flutter

I've been hacking on this for a little while, just started using it ‘in anger’ (in quotes as writing Swift is a complete joy).

I’ve been working on an embedded audio product the past year, the control plane for which is entirely written in Swift. (None of the real-time code, yet, but maybe one day – anyone want to port Swift to XMOS?)

Finding a UI framework that was open source (this is a hobby project), has a modern architecture (i.e. reactive), is ready for production and is suitable for embedded was tricky. (These constraints eliminated Qt, LVGL, and the SwiftUI clones, respectively.)

I ended up using Flutter and I’m quite chuffed with FlutterSwift, a compact bridge between the two. It serves two purposes: first, it’s a Swift native and async/await-friendly implementation of Flutter channels, which are used to communicate between the Flutter VM and native code. There’s nothing embedded-specific about this: you can also use it with the macOS and iOS Flutter embedders. [1] The second part is a native Swift “runner” that hosts the Flutter engine using Sony’s eLinux embedder.

Anyway, it’s not rocket science, but it’s working well for my use case (so far). Dart isn’t so far removed from Swift that it’s difficult to learn, but I still get to write all the interesting stuff in Swift.

[1] Confusingly Flutter uses the term embedder to mean the platform host for Flutter. Nothing to do with embedded systems.

1 Like