Live data from Hacker News

Show HN: Rust GUI Library via Flutter

cjycode.com

1–10 of 108 posts

Show HN: Rust GUI Library via Flutter

#1
Hi, I made a bridge (https://github.com/fzyzcjy/flutter_rust_bridge v2.0.0) between Flutter and Rust, which auto translates syntaxes like arbitrary types, &mut, async, traits, results, closure (callback), lifetimes, etc. The goal is to make a bridge between the two, seamlessly as if working in one single language.

Then, as an example, I showed how to write Rust applications with GUI by utilizing Flutter. That is discussed in the link in details.

To play with it, please visit the GitHub repo, or refer to the end of the article for detailed folders and commands.

When I first released 1.0.0 years ago, it only contained few features compared to today. It is the result of the hard work of contributors and me, and many thanks to all the contributors!

Show HN: Rust GUI Library via Flutter
cjycode.com

Re: Show HN: Rust GUI Library via Flutter

#3
Interesting! IIUC this is done using source-to-source translation? It is a bit hard to understand from the docs what technical approach is. The docs are clearly aimed at users and I find them impressive, well done. I'd be interested in knowing the approach and how it compares to wasm based Rust web frameworks before diving more deeply into it.

One advantage of combining Rust with Flutter seems to be that Flutter is a whole framework already and one would be able to share code and data structures between server and client side.

A comparison with other ways Rust

Re: Show HN: Rust GUI Library via Flutter

#5
I have been using this to build an app[0] for the last couple of years and I want to say that it has been a pleasure to use, there are some wrinkles but overall I have been very happy with the experience.

Upgrading from v1 to v2 was not too difficult and v2 is a significant upgrade with lots of useful features, massively improved codegen experience and support for tokio async were the big gamechangers for me.

Writing all the app business logic in Rust and using Dart as the front-end works out really well. I know Flutter/Dart doesn't get much love here on HN but in my opinion I think it's much easier to reason about than a system like React which I think is the wrong level of abstraction compared to Flutter's render the entire widget tree approach.

Massive thanks to @fzyzcjy for all the work on FRB, great job!

[0]: https://saveoursecrets.com

Re: Show HN: Rust GUI Library via Flutter

#6
While I don't see the advantage of writing UI in Rust vs Dart, I'm a huge fan of flutter_rust_bridge.

The work fzyzcjy and the community have put into calling Rust code from Dart seamlessly is such an asset to Flutter apps. I remade the popular image compression app ImageOptim in Flutter over a weekend because webp wasn't supported. After a little pain in the initial setup, I was able to call mature Rust image libraries using flutter_rust_bridge and a small wrapper[0]. It even handled all the parallelism for me.

The app ended up being more capable and faster than ImageOptim, largely just because of the Rust integration. Thank you fzyzcjy!

[0]: https://github.com/blopker/alic/blob/main/rust/src/api/compr...

Re: Show HN: Rust GUI Library via Flutter

#7
Well done! I've heard only good things about rust_flutter_bridge. Some questions though (more like flutter question), how bloated flutter is (i.e. final app size) compared to mobile native (Java, Swift?) for simple app? And how's the UI performance looks like?

Re: Show HN: Rust GUI Library via Flutter

#8
post #6

While I don't see the advantage of writing UI in Rust vs Dart, I'm a huge fan of flutter_rust_bridge. The work fzyzcjy and the community have put into calling Rust code from Dart seamlessly is such an asset to Flutter apps. I remade the popular image compression app ImageOptim in Flutter over a weekend because webp wasn't supported. After a little pain in the initial setup, I was able to call mature Rust image librar…

[deleted]

Re: Show HN: Rust GUI Library via Flutter

#9
post #4

How does this compare to rinf?

And then there's also crux [1], which is the same "write your mobile app business logic once in Rust", but instead of Flutter, integrates directly with native iOS/Android/Web UIs [1] https://redbadger.github.io/crux/

Tauri supports mobile platforms too. Sadly, it's not a first class citizen in Tauri 2.0 as promised.

I tried both Flutter and Tauri. IMHO: Tauri is better, because it allows me to use existing web frameworks (or even plain Markdown + Pandoc!), to make web-pages, while handling business logic in type safe Rust.

Post reply on HN