Live data from Hacker News

Show HN: Rust GUI Library via Flutter

cjycode.com

31–40 of 108 posts

Re: Show HN: Rust GUI Library via Flutter

#31
post #19

Commendable effort! I’m currently using Tauri for a project myself and was wondering if anyone has any pros/cons between the two?

Thank you! I heard some people saying that, for apps using JavaScript, Tauri is replacing Electron and is popular nowadays, since Electron is very widely used. It seems Tauri cannot let Rust communicate with JavaScript very seamlessly yet, e.g. https://tauri.app/v1/guides/features/command/ seems to have mainly basic features. oneshtein mentioned below that Tauri does not support mobile as first class citizen yet as w…

Thanks for the info! I will keep an eye on this for future projects, keen to try it out. I’m currently working on a project being converted from Electron to Rust/Tauri. I recall Flutter being discussed, but our frontend dev was more comfortable with React.

Re: Show HN: Rust GUI Library via Flutter

#32

Isn't Flutter basically a way to use the C++ render engine from Chrome, with a "scripting" language most similar to Kotlin and Swift? Why not just use the Chrome render engine directly from Rust? Why all the extra steps?

> Why not just use the Chrome render engine directly from Rust?

This is what projects like Tauri (in Rust) and Wails (in Go) are doing[0][1]. Utilizing Webview to develop applications, but they still don't support mobile, Tauri mobile is in beta.

Basically Tauri and Wails are on one side (HTML/CSS) trying to approach cross platform by supporting mobile platforms, while Flutter and Kotlin Compose Multiplatform started from the other side.

So it depends on your needs, web-first or mobile-first, and what platforms matter to you. So far Flutter is in the lead offering the most polished experience when it comes to supporting all platforms (Web, desktop, iOS, Android).

[0] https://github.com/tauri-apps/tauri

[1] https://github.com/wailsapp/wails

Re: Show HN: Rust GUI Library via Flutter

#33
post #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…

But, Flutter and React work the same way where UI is a function of state. In fact, Flutter started off imperatively but after React was released, they changed it to be declarative, and now Android via Jetpack Compose is changing to be declarative, all on the same general principle. I also use packages like flutter_hooks or ReArch which make encapsulating state much easier, I couldn't stand using initState and not forgetting to dispose for each piece of functionality.

Re: Show HN: Rust GUI Library via Flutter

#34

Earlier quoted context omitted.

Isn't Dart type safe?

Dart is order of magnitude slower than Rust.

If you’re doing some super intensive data processing or have specialist use cases then yeah, sure feel free to write that part in Rust, C or whatever you like.

That’s literally what this package is about. Unlocking that use case for you although Dart also has bindings for Go, Java, Kotlin, C, and Swift so you can take your pick.

But the reality is that Dart compiles down to native code on all platforms and is not going to be slower in any way that actually matters or is noticeable to users in the vast vast vast majority of scenarios and the productivity hit you take from moving to Rust or C from Dart is also an order of magnitude slower.

Re: Show HN: Rust GUI Library via Flutter

#35
post #27
post #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…

> 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. Could you expand on this a bit? My impression was that Flutter and React had relatively similar approaches to components, but I haven't had much experience with Flutter ye…

They do have similar approaches, I'm not sure what the above commenter is saying as both work basically the same (with React class components at least). Flutter doesn't have hooks but they're addressing that via macros next year, and anyway today there are packages like flutter_hooks and ReArch that enable hook-like functionality in Flutter today.

Re: Show HN: Rust GUI Library via Flutter

#36
post #27
post #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…

> 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. Could you expand on this a bit? My impression was that Flutter and React had relatively similar approaches to components, but I haven't had much experience with Flutter ye…

At a basic level Flutter renders the entire widget tree and caches components that don't need to re-render rather than applying a diff of changes to the DOM.

But it's really the Flutter/Dart API and widgets that make it much easier to work with, if I need to load some data asynchronously I use a `FutureBuilder`, if I need a stream of events I can use `StreamBuilder` etc. Compared to Reacts state, hooks, memo, effects etc. you end up with code that is far easier to reason about what is rendering when and why.

Oh and the real killer feature is Flutters hot reload experience, it's easily the best DX I've seen for GUI work.

As another comment mentioned it really is like night and day. I recommend giving it a try.

Re: Show HN: Rust GUI Library via Flutter

#38

Earlier quoted context omitted.

Isn't Dart type safe?

Dart is order of magnitude slower than Rust.

I wasn't trying to be argumentative, and certainly rust is faster than dart, but if type safety is your main concern Dart/Flutter is less convoluted/complicated than rust+web frontend. In my opinion, obviously.

Re: Show HN: Rust GUI Library via Flutter

#40

Cool, but the point of having stuff in Rust is to ideally have everything in Rust, or you're by definition not getting all the safety benefits of Rust.

Not at all, pretty much all popular languages (except C/C++) are as safe as (safe) rust. The only safety rust brings to the table is memory safety, which most languages achieve with a runtime and a garbage collector, which have a performance tradeoff.
Post reply on HN